Click here to Skip to main content
12,758,918 members (26,522 online)

C / C++ / MFC

 
AnswerRe: Long pointer to character C++ Pin
Richard MacCutchan28-Nov-12 6:20
mvpRichard MacCutchan28-Nov-12 6:20 
AnswerRe: Long pointer to character C++ Pin
Stefan_Lang28-Nov-12 7:07
memberStefan_Lang28-Nov-12 7:07 
GeneralRe: Long pointer to character C++ Pin
DavidCrow28-Nov-12 8:56
memberDavidCrow28-Nov-12 8:56 
GeneralRe: Long pointer to character C++ Pin
Stefan_Lang28-Nov-12 23:03
memberStefan_Lang28-Nov-12 23:03 
AnswerRe: Long pointer to character C++ Pin
CPallini28-Nov-12 8:48
mvpCPallini28-Nov-12 8:48 
AnswerRe: Long pointer to character C++ Pin
sajeesh.c30-Nov-12 19:35
membersajeesh.c30-Nov-12 19:35 
AnswerRe: Long pointer to character C++ Pin
April Fans13-Dec-12 19:06
memberApril Fans13-Dec-12 19:06 
Questionproblem in c with linux Pin
a1_shay28-Nov-12 3:23
membera1_shay28-Nov-12 3:23 
i need to make program that i give some system command like ls,date et cetera.and to check if thre is path that include this command(file).i have variable commandandparameters that start to change in the last loop while and i dont know why.
i put puts(commandandparameters); to show that the output is not good if you want to run it.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main()
{
    char *arr[5];//for the command and his parameter
    char command[10];
    int i,j;
    char *path=NULL,*tempath,*finalpath,*commandandparameters;
    do
    {
        i=0;
        printf("enter new command:");
        gets(command);
        arr[i]=strtok(command," ");
        while(arr[i]!=NULL)//save the command and also the parametrs
        {
            i++;
            arr[i]=strtok(NULL," ");
        }
        strcpy(commandandparameters,arr[0]);//add first command
        for(j=1;j<i;j++)//add the parameters
            {
                strcat(commandandparameters," ");
                strcat(commandandparameters,arr[j]);
            }
        //now we check if the command in every path
        path = getenv("PATH");
        tempath = strtok(path,":");
        while (tempath != NULL)
        {
            strcpy(finalpath,tempath);//get the current path
            puts(commandandparameters);
            strcat(finalpath,"/");//we add '/'
            execl(finalpath,commandandparameters,NULL);
            tempath = strtok(NULL, ":");//get next path
        }
    }while(command!="leave");
}

AnswerRe: problem in c with linux Pin
CPallini28-Nov-12 4:07
mvpCPallini28-Nov-12 4:07 
SuggestionRe: problem in c with linux Pin
Richard MacCutchan28-Nov-12 4:11
mvpRichard MacCutchan28-Nov-12 4:11 
GeneralRe: problem in c with linux Pin
a1_shay28-Nov-12 22:35
membera1_shay28-Nov-12 22:35 
GeneralRe: problem in c with linux Pin
Richard MacCutchan29-Nov-12 0:04
mvpRichard MacCutchan29-Nov-12 0:04 
AnswerRe: problem in c with linux Pin
sajeesh.c30-Nov-12 19:40
membersajeesh.c30-Nov-12 19:40 
QuestionMerging Arrays Pin
pix_programmer27-Nov-12 22:57
memberpix_programmer27-Nov-12 22:57 
AnswerRe: Merging Arrays Pin
Andy41127-Nov-12 23:48
memberAndy41127-Nov-12 23:48 
AnswerRe: Merging Arrays Pin
CPallini28-Nov-12 0:09
mvpCPallini28-Nov-12 0:09 
JokeRe: Merging Arrays Pin
Richard MacCutchan28-Nov-12 0:45
mvpRichard MacCutchan28-Nov-12 0:45 
JokeRe: Merging Arrays Pin
CPallini28-Nov-12 0:58
mvpCPallini28-Nov-12 0:58 
GeneralRe: Merging Arrays Pin
DavidCrow28-Nov-12 6:36
memberDavidCrow28-Nov-12 6:36 
AnswerRe: Merging Arrays Pin
Stefan_Lang28-Nov-12 3:45
memberStefan_Lang28-Nov-12 3:45 
AnswerRe: Merging Arrays Pin
sajeesh.c30-Nov-12 19:47
membersajeesh.c30-Nov-12 19:47 
QuestionHow to use ribbon in MFC Activex control Pin
Lamourou27-Nov-12 21:23
memberLamourou27-Nov-12 21:23 
AnswerRe: How to use ribbon in MFC Activex control Pin
Richard MacCutchan28-Nov-12 0:44
mvpRichard MacCutchan28-Nov-12 0:44 
GeneralMessage Removed Pin
Lamourou28-Nov-12 1:26
memberLamourou28-Nov-12 1:26 
GeneralRe: How to use ribbon in MFC Activex control Pin
Richard MacCutchan28-Nov-12 2:10
mvpRichard MacCutchan28-Nov-12 2:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 21 Feb 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid