while bytesremaining >=8 do something;
if bytesremaing <8 then something else
I am sorry but I am new and don't know how to code for this.
Thanks
while bytesremaining >=8 do something;
if bytesremaing <8 then something else
I am sorry but I am new and don't know how to code for this.
Thanks
You shouldn't need to. The functions you're calling to read data from the file (fread, fgets, getc) will tell you whether there is no input left in the file. If you're reading chunks, each eight bytes long, then I suggest looking into fread.
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
You set size to 1, and nmemb to 8.
You look at the return result to see how many bytes you actually read.
You then do your if / else thing.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.