Click here to Skip to main content
15,885,435 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Long pointer to character C++ Pin
Richard MacCutchan28-Nov-12 5:20
mveRichard MacCutchan28-Nov-12 5:20 
AnswerRe: Long pointer to character C++ Pin
Stefan_Lang28-Nov-12 6:07
Stefan_Lang28-Nov-12 6:07 
GeneralRe: Long pointer to character C++ Pin
David Crow28-Nov-12 7:56
David Crow28-Nov-12 7:56 
GeneralRe: Long pointer to character C++ Pin
Stefan_Lang28-Nov-12 22:03
Stefan_Lang28-Nov-12 22:03 
AnswerRe: Long pointer to character C++ Pin
CPallini28-Nov-12 7:48
mveCPallini28-Nov-12 7:48 
AnswerRe: Long pointer to character C++ Pin
Sajeesh Payolam30-Nov-12 18:35
Sajeesh Payolam30-Nov-12 18:35 
AnswerRe: Long pointer to character C++ Pin
April Fans13-Dec-12 18:06
April Fans13-Dec-12 18:06 
Questionproblem in c with linux Pin
a1_shay28-Nov-12 2:23
a1_shay28-Nov-12 2: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 3:07
mveCPallini28-Nov-12 3:07 
SuggestionRe: problem in c with linux Pin
Richard MacCutchan28-Nov-12 3:11
mveRichard MacCutchan28-Nov-12 3:11 
GeneralRe: problem in c with linux Pin
a1_shay28-Nov-12 21:35
a1_shay28-Nov-12 21:35 
GeneralRe: problem in c with linux Pin
Richard MacCutchan28-Nov-12 23:04
mveRichard MacCutchan28-Nov-12 23:04 
AnswerRe: problem in c with linux Pin
Sajeesh Payolam30-Nov-12 18:40
Sajeesh Payolam30-Nov-12 18:40 
QuestionMerging Arrays Pin
pix_programmer27-Nov-12 21:57
pix_programmer27-Nov-12 21:57 
AnswerRe: Merging Arrays Pin
Andy41127-Nov-12 22:48
Andy41127-Nov-12 22:48 
AnswerRe: Merging Arrays Pin
CPallini27-Nov-12 23:09
mveCPallini27-Nov-12 23:09 
JokeRe: Merging Arrays Pin
Richard MacCutchan27-Nov-12 23:45
mveRichard MacCutchan27-Nov-12 23:45 
JokeRe: Merging Arrays Pin
CPallini27-Nov-12 23:58
mveCPallini27-Nov-12 23:58 
GeneralRe: Merging Arrays Pin
David Crow28-Nov-12 5:36
David Crow28-Nov-12 5:36 
AnswerRe: Merging Arrays Pin
Stefan_Lang28-Nov-12 2:45
Stefan_Lang28-Nov-12 2:45 
AnswerRe: Merging Arrays Pin
Sajeesh Payolam30-Nov-12 18:47
Sajeesh Payolam30-Nov-12 18:47 
QuestionHow to use ribbon in MFC Activex control Pin
Lamourou27-Nov-12 20:23
Lamourou27-Nov-12 20:23 
AnswerRe: How to use ribbon in MFC Activex control Pin
Richard MacCutchan27-Nov-12 23:44
mveRichard MacCutchan27-Nov-12 23:44 
GeneralMessage Closed Pin
28-Nov-12 0:26
Lamourou28-Nov-12 0:26 
GeneralRe: How to use ribbon in MFC Activex control Pin
Richard MacCutchan28-Nov-12 1:10
mveRichard MacCutchan28-Nov-12 1: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.