Is there a way to use sscanf with stdin?
- by j_eng
I have a program that either takes data from a file or from the standard input.
I wrote code for scanning the file using sscanf.
I was wondering if I could reuse that code but with stdin instead of using scanf?
Ex:
How could I modify this so that it works with standard input?
while(fgets(buffer, MAX_LEN, input) != NULL) {
if (sscanf(buffer, "%s %s %s", one, two, three) == 3) { }
}