Can I rightfully name my opened file a stream if at some point I move its file-pointer backward?

50 views Asked by At

Quoting from https://learn.microsoft.com/en-us/cpp/c-runtime-library/files-and-streams?view=msvc-170

Before you can perform many of the operations on a file, the file must be opened. Opening a file associates it with a stream, ...

I am writing an assembly program where I will be reading from a file. I'd like to treat the file as a stream, reading a byte at a time and halting once the end-of-file marker comes by. On occasion, I could be setting the file-pointer back and now I'm wondering if this behavior is stream-like? I've always felt that once a byte gets out of a stream, it is out forever.
I have no problem with setting the file-pointer forward as that is the same as just reading some number of bytes but not doing any useful work on them.

0

There are 0 answers