Click here to Skip to main content
15,502,868 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Long pointer to character C++ Pin
Richard MacCutchan28-Nov-12 6:20
mveRichard MacCutchan28-Nov-12 6:20 
AnswerRe: Long pointer to character C++ Pin
Stefan_Lang28-Nov-12 7:07
mveStefan_Lang28-Nov-12 7:07 
GeneralRe: Long pointer to character C++ Pin
David Crow28-Nov-12 8:56
David Crow28-Nov-12 8:56 
GeneralRe: Long pointer to character C++ Pin
Stefan_Lang28-Nov-12 23:03
mveStefan_Lang28-Nov-12 23:03 
AnswerRe: Long pointer to character C++ Pin
CPallini28-Nov-12 8:48
mveCPallini28-Nov-12 8:48 
AnswerRe: Long pointer to character C++ Pin
Sajeesh Payolam30-Nov-12 19:35
Sajeesh Payolam30-Nov-12 19:35 
AnswerRe: Long pointer to character C++ Pin
April Fans13-Dec-12 19:06
April Fans13-Dec-12 19:06 
Questionproblem in c with linux Pin
a1_shay28-Nov-12 3:23
a1_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><br />
#include <string.h><br />
#include <stdlib.h><br />
void main()<br />
{<br />
    char *arr[5];//for the command and his parameter<br />
    char command[10];<br />
    int i,j;<br />
    char *path=NULL,*tempath,*finalpath,*commandandparameters;<br />
    do<br />
    {<br />
        i=0;<br />
        printf("enter new command:");<br />
        gets(command);<br />
        arr[i]=strtok(command," ");<br />
        while(arr[i]!=NULL)//save the command and also the parametrs<br />
        {<br />
            i++;<br />
            arr[i]=strtok(NULL," ");<br />
        }<br />
        strcpy(commandandparameters,arr[0]);//add first command<br />
        for(j=1;j<i;j++)//add the parameters<br />
            {<br />
                strcat(commandandparameters," ");<br />
                strcat(commandandparameters,arr[j]);<br />
            }<br />
        //now we check if the command in every path<br />
        path = getenv("PATH");<br />
        tempath = strtok(path,":");<br />
        while (tempath != NULL)<br />
        {<br />
            strcpy(finalpath,tempath);//get the current path<br />
            puts(commandandparameters);<br />
            strcat(finalpath,"/");//we add '/'<br />
            execl(finalpath,commandandparameters,NULL);<br />
            tempath = strtok(NULL, ":");//get next path<br />
        }<br />
    }while(command!="leave");<br />
}

AnswerRe: problem in c with linux Pin
CPallini28-Nov-12 4:07
mveCPallini28-Nov-12 4:07 
SuggestionRe: problem in c with linux Pin
Richard MacCutchan28-Nov-12 4:11
mveRichard MacCutchan28-Nov-12 4:11 
GeneralRe: problem in c with linux Pin
a1_shay28-Nov-12 22:35
a1_shay28-Nov-12 22:35 
GeneralRe: problem in c with linux Pin
Richard MacCutchan29-Nov-12 0:04
mveRichard MacCutchan29-Nov-12 0:04 
AnswerRe: problem in c with linux Pin
Sajeesh Payolam30-Nov-12 19:40
Sajeesh Payolam30-Nov-12 19:40 
QuestionMerging Arrays Pin
pix_programmer27-Nov-12 22:57
pix_programmer27-Nov-12 22:57 
AnswerRe: Merging Arrays Pin
Andy41127-Nov-12 23:48
Andy41127-Nov-12 23:48 
AnswerRe: Merging Arrays Pin
CPallini28-Nov-12 0:09
mveCPallini28-Nov-12 0:09 
JokeRe: Merging Arrays Pin
Richard MacCutchan28-Nov-12 0:45
mveRichard MacCutchan28-Nov-12 0:45 
JokeRe: Merging Arrays Pin
CPallini28-Nov-12 0:58
mveCPallini28-Nov-12 0:58 
GeneralRe: Merging Arrays Pin
David Crow28-Nov-12 6:36
David Crow28-Nov-12 6:36 
AnswerRe: Merging Arrays Pin
Stefan_Lang28-Nov-12 3:45
mveStefan_Lang28-Nov-12 3:45 
AnswerRe: Merging Arrays Pin
Sajeesh Payolam30-Nov-12 19:47
Sajeesh Payolam30-Nov-12 19:47 
QuestionHow to use ribbon in MFC Activex control Pin
Lamourou27-Nov-12 21:23
Lamourou27-Nov-12 21:23 
AnswerRe: How to use ribbon in MFC Activex control Pin
Richard MacCutchan28-Nov-12 0:44
mveRichard MacCutchan28-Nov-12 0:44 
GeneralMessage Closed Pin
28-Nov-12 1:26
Lamourou28-Nov-12 1:26 
GeneralRe: How to use ribbon in MFC Activex control Pin
Richard MacCutchan28-Nov-12 2:10
mveRichard 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.