I have this file with multiple lines. Each line follows a format of
`userID:$An Integer$$String:`
For example:
pyc1:$1$$Tnq7a6/C1wwyKyt0V/.BP/:
pyc2:$6$$Tnq7a6/C1wwyKyt0V/.BP/:
How should I use fscanf() to retrieve the userID, the integer, and the string between $$ and :`?
This is what I have now, but it is not working.
int main(){
FILE * file = fopen("shadow.txt", "r");
char line[256] = {0};
char userID[30] = {0};
int hashType;
char hash[256] = {0};
int result = fscanf(file, "%s :$ %d $$ %s :", userID, &hashType, hash);
printf("%s\n", userID );
printf("%d\n", hashType );
printf("%s\n", hash );
}
I don't know much about the format I should specify for fscanf() to achieve this. Please help.