Click here to Skip to main content
15,921,716 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: filter all application messages Pin
alex.barylski8-Dec-04 20:45
alex.barylski8-Dec-04 20:45 
GeneralPage break in html Pin
Member 12010138-Dec-04 20:05
Member 12010138-Dec-04 20:05 
GeneralRe: Page break in html Pin
alex.barylski8-Dec-04 20:44
alex.barylski8-Dec-04 20:44 
GeneralText Wrap in Static control Pin
Pushkar Tamboli8-Dec-04 19:53
Pushkar Tamboli8-Dec-04 19:53 
GeneralRe: Text Wrap in Static control Pin
A T I F8-Dec-04 20:39
A T I F8-Dec-04 20:39 
GeneralRe: Text Wrap in Static control Pin
Pushkar Tamboli8-Dec-04 22:20
Pushkar Tamboli8-Dec-04 22:20 
GeneralRe: Text Wrap in Static control Pin
namaskaaram8-Dec-04 23:37
namaskaaram8-Dec-04 23:37 
Questioncheck box could be owner draw? Pin
lowiq8-Dec-04 19:51
lowiq8-Dec-04 19:51 
GeneralMarcos in MFC Pin
Amit Mulay8-Dec-04 19:16
Amit Mulay8-Dec-04 19:16 
GeneralRe: Marcos in MFC Pin
alex.barylski8-Dec-04 19:19
alex.barylski8-Dec-04 19:19 
GeneralRe: Marcos in MFC Pin
toxcct8-Dec-04 22:08
toxcct8-Dec-04 22:08 
GeneralPlease clear this doubt Pin
Sreekanth Muralidharan8-Dec-04 16:40
Sreekanth Muralidharan8-Dec-04 16:40 
GeneralPicking transparent color from a gif Pin
Abin8-Dec-04 16:30
Abin8-Dec-04 16:30 
GeneralCMapStringToOb :: lookup() Pin
Anonymous8-Dec-04 16:25
Anonymous8-Dec-04 16:25 
GeneralRe: CMapStringToOb :: lookup() Pin
RChin8-Dec-04 22:42
RChin8-Dec-04 22:42 
GeneralFile dialog Office 2003 style Pin
Gagnon Claude8-Dec-04 16:05
Gagnon Claude8-Dec-04 16:05 
GeneralGettin an error... Pin
Pheonix288-Dec-04 15:36
sussPheonix288-Dec-04 15:36 
GeneralRe: Gettin an error... Pin
Tom Wright8-Dec-04 16:19
Tom Wright8-Dec-04 16:19 
GeneralRe: Gettin an error... Pin
bryce8-Dec-04 17:46
bryce8-Dec-04 17:46 
GeneralRe: Gettin an error... Pin
Cedric Moonen8-Dec-04 22:24
Cedric Moonen8-Dec-04 22:24 
General2 ?'s Pin
3dman8-Dec-04 15:10
3dman8-Dec-04 15:10 
GeneralRe: 2 ?'s Pin
Maximilien8-Dec-04 15:22
Maximilien8-Dec-04 15:22 
Generalremove an icon from the status tray (system tray) Pin
Tom Wright8-Dec-04 14:44
Tom Wright8-Dec-04 14:44 
GeneralHelp with Strtok Pin
civicnar8-Dec-04 13:43
civicnar8-Dec-04 13:43 
Here is the section out of my program that I am having problems with.

char first[20];



ifstream
fin;


openfile(fin);


char str[20];
char* trun;
char* trun2;
char *seps = "\0";

while (!fin.eof())
{fin.getline(str, 30, '\n');
fin.ignore(1);
cout<<str<<endl;
trun = strtok (str,seps);
cout<<"---"<<trun<<"---\n";
if (!doRetrieveVertex (graph, trun))
{doInsertVertex (graph, trun);}
strcpy(first, trun);

while (trun2 != NULL)
{ cout<<trun2;
trun2 = strtok (NULL, seps); \\Here

if (!doRetrieveVertex (graph, trun2))
doInsertVertex (graph, trun2);


cout<<"Internal while";
}
cout<<"External while";

}

1 2 50 3 70 4 23
2 1 50 3 34 4 75
3 1 70 2 34 4 80
4 1 23 2 75 3 80


Here is some sample data that we created and also I changed where seps is to " " so that it will break it into pieces. Basically what it is doing is getting the first line and then breaking off th efirst piece and retaining that and then breaking the others off and adding those. We are making a graph if you are wondering.


If I comment out where it says "trun2 = strtok (NULL, seps);" Then it will run but it stays in an infinite loop inside that Internal while loop. But if I do not then I get a core dump. Please help me if you can it is due tomorrow. Thanks

James

GeneralRe: Help with Strtok Pin
Christian Graus8-Dec-04 13:47
protectorChristian Graus8-Dec-04 13:47 

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.