Hello,
I have a file with approx. 2 million rows. I wrote a simple script to simply print out each row but the script is only printing out the first 745000 rows...I would really appreciate it if someone could let my know why.
Code:
#include <stdio.h>
#include <stdlib.h>
enum { SIZE = 2000000 };
int main(int argc, const char * argv[])
{
  char b[SIZE];
        FILE *fp = fopen("myfile.txt","r");
    size_t ret_code = fread(b, sizeof *b, sizeof(b)/sizeof(b[0]), fp); 
    if(ret_code == SIZE) {
        for(int n = 0; n < SIZE; ++n) printf("%c", b[n]);
        {
        putchar('\n');
        }
    } else { 
        if (feof(fp))
        {
            printf("Error reading test.bin: unexpected end of file\n");
        }
        else if (ferror(fp)) {
            perror("Error reading test.bin");
        }
    }