Okay, so I'm basically trying to get a single number from a single line text file... only I haven't gotten to that point because something weird is going on.
The entire contents of the text file is this:
But when I run my program, the output is this:Code:frame= 3900 fps=274 q=3.0 Lsize= 12043kB time=162.50 bitrate= 607.1kbits/s
I'm sure I've done something really stupid here.... but what's going on? Why are the numbers changing?Code:frame= 3609 fps=275 q=3.0 size= 11034kB time=150.24 bitrate= 609.9kbits/s
Code:#include <stdio.h> #include <stdlib.h> #include <limits.h> main() { char oneline[LINE_MAX]; FILE *logfile; logfile = fopen("out.txt", "r"); if (logfile == NULL) { printf("Couldn't open\n"); exit(1); } fgets(oneline, LINE_MAX, logfile); fclose(logfile); printf("%s\n", oneline); exit(0); }



LinkBack URL
About LinkBacks



