adrianmah
Computer
- Mar 31, 2003
- 4
Hi, i am newin this. can you help me on this problem? I am trying to capture a string of data seperated by ":". is this coding correct? else please help.
text of string to capture:
12:Ian Richards:Africa:33 Beach Street:Hervey Bay:4655
07)4567 8901
34:Yan Li:Secret:13 Mockingbird Lane:Mysteryville:7654
03)2345 6789
coding:
fscanf(fptr, "%2s %c %[^\:] %c %[^\:]%*[^\:]%*c %c %[^\:] %c %[^\:] %c %[^\n]\n", newPtr->id,o, newPtr->name,o, newPtr->password,o, newPtr->address,o, newPtr->code,o, newPtr->phone);
o is use to capture the ":".
please help.
text of string to capture:
12:Ian Richards:Africa:33 Beach Street:Hervey Bay:4655
34:Yan Li:Secret:13 Mockingbird Lane:Mysteryville:7654
coding:
fscanf(fptr, "%2s %c %[^\:] %c %[^\:]%*[^\:]%*c %c %[^\:] %c %[^\:] %c %[^\n]\n", newPtr->id,o, newPtr->name,o, newPtr->password,o, newPtr->address,o, newPtr->code,o, newPtr->phone);
o is use to capture the ":".
please help.