Click here to Skip to main content
15,912,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Updating resource in yourself Pin
Paresh Chitte31-Oct-07 22:39
Paresh Chitte31-Oct-07 22:39 
GeneralRe: Updating resource in yourself Pin
LiveShell31-Oct-07 23:10
LiveShell31-Oct-07 23:10 
QuestionNoob need help in c pro.. Pin
cue_ball31-Oct-07 21:54
cue_ball31-Oct-07 21:54 
AnswerRe: Noob need help in c pro.. Pin
cue_ball31-Oct-07 21:58
cue_ball31-Oct-07 21:58 
AnswerRe: Noob need help in c pro.. Pin
John R. Shaw31-Oct-07 22:20
John R. Shaw31-Oct-07 22:20 
GeneralRe: Noob need help in c pro.. Pin
cue_ball31-Oct-07 22:33
cue_ball31-Oct-07 22:33 
GeneralRe: Noob need help in c pro.. Pin
John R. Shaw1-Nov-07 12:50
John R. Shaw1-Nov-07 12:50 
AnswerRe: Noob need help in c pro.. Pin
Iain Clarke, Warrior Programmer1-Nov-07 2:26
Iain Clarke, Warrior Programmer1-Nov-07 2:26 
You may only be interested in strings #2 & #3 - but you'll need to read #1 as well. Just throw it away very rapidly!

You need to break the program in to bits.

1/ Open the text file.
2/ Go through it one line at a time
3/ parse the line to get the three thingies from it (sscanf)
4/ throw away Name, and hang on to the other two.
5/ go back to step 2, until you get to EOF (or some other method)

Here is step 3.
Assuming you have a character string with the three words / numbers in it.

char test [] = "iain 1234 clarke"; // test string
char password [256]; // leave plenty of room
int id;

while (GetThingsFromLine (test, &id, password))
{
   DoStuff (id, password);
}


BOOL GetThingsFromLine (char *test, int *id, char *password)
{
   char name [256]; // we need to store it briefly
   return sscanf (test, "%s %i %s", name, id, password) != 0;
}


I hope that helps a bit!

Iain.



GeneralRe: Noob need help in c pro.. Pin
Robert Surtees1-Nov-07 14:40
Robert Surtees1-Nov-07 14:40 
AnswerRe: Noob need help in c pro.. Pin
Vijjuuu.1-Nov-07 2:43
Vijjuuu.1-Nov-07 2:43 
AnswerRe: Noob need help in c pro.. Pin
David Crow1-Nov-07 3:21
David Crow1-Nov-07 3:21 
QuestionHow to get a device's firmware Serial Number? Pin
kcynic31-Oct-07 21:07
kcynic31-Oct-07 21:07 
AnswerRe: How to get a device's firmware Serial Number? Pin
codn1-Nov-07 1:04
codn1-Nov-07 1:04 
QuestionAbout CImageList Pin
fantasy121531-Oct-07 20:40
fantasy121531-Oct-07 20:40 
AnswerRe: About CImageList Pin
Naveen31-Oct-07 20:51
Naveen31-Oct-07 20:51 
AnswerRe: About CImageList Pin
Hamid_RT31-Oct-07 21:02
Hamid_RT31-Oct-07 21:02 
QuestionRe: About CImageList Pin
fantasy121531-Oct-07 21:46
fantasy121531-Oct-07 21:46 
AnswerRe: About CImageList Pin
Hamid_RT1-Nov-07 1:07
Hamid_RT1-Nov-07 1:07 
Question[Message Deleted] Pin
purplee8531-Oct-07 19:57
purplee8531-Oct-07 19:57 
AnswerRe: GDIPLUS.h Pin
Naveen31-Oct-07 20:22
Naveen31-Oct-07 20:22 
AnswerRe: GDIPLUS.h Pin
Hamid_RT31-Oct-07 21:02
Hamid_RT31-Oct-07 21:02 
AnswerRe: [Message Deleted] Pin
ThatsAlok1-Nov-07 0:16
ThatsAlok1-Nov-07 0:16 
QuestionRe: [Message Deleted] Pin
Hamid_RT1-Nov-07 1:09
Hamid_RT1-Nov-07 1:09 
QuestionHow to include omnithread in my application? Pin
ashishbhatt31-Oct-07 19:45
ashishbhatt31-Oct-07 19:45 
AnswerRe: How to include omnithread in my application? Pin
Iain Clarke, Warrior Programmer1-Nov-07 2:43
Iain Clarke, Warrior Programmer1-Nov-07 2:43 

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.