When you use fseek() and ftell(), I'm wondering when you read a line into a buffer (eg. getline, fgets), when you use ftell, does it read the position as the beginning of that line even after called after getline?
When you use fseek() and ftell(), I'm wondering when you read a line into a buffer (eg. getline, fgets), when you use ftell, does it read the position as the beginning of that line even after called after getline?
Oh, and does strstr advance the position in the stream?
Sorry that these are noobish question, but it's a really hard thing to google for.
No and no.
ftell() will tell you how many bytes you are into the stream, there is really no concept of lines. If you read a "line" with fgets() then ftell() would give you the position after what you just read, ie the file-pointer has moved forward (since you read bytes). strstr() has nothing to do with file streams etc, I assume you mean calling strstr() on a buffer read from a file?
yeah, thanks very much for the reply. that's exactly what I was looking for. I wasn't sure