Click here to Skip to main content
15,891,184 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to parse a file and store few strings in an array Pin
Faez Shingeri8-Feb-12 22:28
Faez Shingeri8-Feb-12 22:28 
AnswerRe: How to parse a file and store few strings in an array Pin
SandipG 8-Feb-12 22:38
SandipG 8-Feb-12 22:38 
GeneralRe: How to parse a file and store few strings in an array Pin
Faez Shingeri8-Feb-12 22:47
Faez Shingeri8-Feb-12 22:47 
GeneralRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan8-Feb-12 23:13
mveRichard MacCutchan8-Feb-12 23:13 
QuestionRe: How to parse a file and store few strings in an array Pin
David Crow9-Feb-12 2:33
David Crow9-Feb-12 2:33 
AnswerRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan9-Feb-12 2:58
mveRichard MacCutchan9-Feb-12 2:58 
GeneralRe: How to parse a file and store few strings in an array Pin
Faez Shingeri9-Feb-12 17:55
Faez Shingeri9-Feb-12 17:55 
GeneralRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan9-Feb-12 22:04
mveRichard MacCutchan9-Feb-12 22:04 
Try this:
C++
BOOL bCapture = FALSE; // flag to ignore unwanted tokens
while(fgets(buf, bufsize, fp1) != NULL)
{
    tok = strtok(buf,"{ ,}");
    if (tok != NULL)
    {
        if (bCapture == FALSE)
        {
            // not capturing yet, so check for start of list
            if (strcmp(tok, "EXEC") == 0)
                bCapture = TRUE;
        }
        else  // bCapture == TRUE
        {
            // bCapture is true so check for end of
            // list, or display token
            if (strcmp(tok, "END-EXEC") == 0)
                bCapture = FALSE;
            else
                printf("Token: %s\n", tok);
        }
    }
}

[edit]Fixed the "END-EXEC" string, thanks to Carlo for pointing it out.[/edit]
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman




modified 10-Feb-12 6:56am.

GeneralRe: How to parse a file and store few strings in an array Pin
CPallini9-Feb-12 23:11
mveCPallini9-Feb-12 23:11 
GeneralRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan10-Feb-12 0:42
mveRichard MacCutchan10-Feb-12 0:42 
GeneralRe: How to parse a file and store few strings in an array Pin
CPallini10-Feb-12 0:48
mveCPallini10-Feb-12 0:48 
GeneralRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan10-Feb-12 0:57
mveRichard MacCutchan10-Feb-12 0:57 
GeneralRe: How to parse a file and store few strings in an array Pin
Faez Shingeri10-Feb-12 1:26
Faez Shingeri10-Feb-12 1:26 
GeneralRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan10-Feb-12 6:26
mveRichard MacCutchan10-Feb-12 6:26 
GeneralRe: How to parse a file and store few strings in an array Pin
Faez Shingeri11-Feb-12 6:39
Faez Shingeri11-Feb-12 6:39 
GeneralRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan11-Feb-12 7:11
mveRichard MacCutchan11-Feb-12 7:11 
GeneralRe: How to parse a file and store few strings in an array Pin
Faez Shingeri12-Feb-12 19:19
Faez Shingeri12-Feb-12 19:19 
GeneralRe: How to parse a file and store few strings in an array Pin
Richard MacCutchan12-Feb-12 21:39
mveRichard MacCutchan12-Feb-12 21:39 
GeneralRe: How to parse a file and store few strings in an array Pin
David Crow10-Feb-12 7:14
David Crow10-Feb-12 7:14 
QuestionDirectshow Pin
venkatesh528677-Feb-12 21:22
venkatesh528677-Feb-12 21:22 
AnswerRe: Directshow Pin
Richard MacCutchan7-Feb-12 22:31
mveRichard MacCutchan7-Feb-12 22:31 
QuestionAdd text to listbox using sendmessage, i'm baffled, c++ win32 Pin
jkirkerx7-Feb-12 10:03
professionaljkirkerx7-Feb-12 10:03 
AnswerRe: Add text to listbox using sendmessage, i'm baffled, c++ win32 Pin
Wes Aday7-Feb-12 10:58
professionalWes Aday7-Feb-12 10:58 
GeneralNo it's not a typo Pin
jkirkerx7-Feb-12 11:31
professionaljkirkerx7-Feb-12 11:31 
GeneralRe: No it's not a typo Pin
Wes Aday7-Feb-12 11:55
professionalWes Aday7-Feb-12 11:55 

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.