OK, what you could try doing is capturing the string between input and then store it into a seperate string to test. This is what I would try:
Code:
int main(){
char Record[MAX_RECORD];
char Name[128];
char GivenName[128];
char Gender[10];
char IdNum[128];
int Pos = 0;
//Get Input From user and store it to Record
Pos = CaptureString(Record, IdNum, Pos);
Pos = CaptureString(Record, Name, Pos);
Pos = CaptureString(Record, GivenName, Pos);
Pos = CaptureString(Record, Gender, Pos);
//Validate input
return 0;
}
int CaptureString(char Record[], char Capture[], int Pos){
int Loc = 0;
while(Record[Pos]!=':'&&Pos<strlen(Record)){
Capture[Loc++] = Record[Pos++];
}
Pos++;
Capture[Loc] = '\0';
}
- Sean