#include #include int main(int argc, char** argv) { // open the file using argv[1] // FILE* fp = fopen(argv[1], "r"); // set a buffer size // long N = atoi(argv[2]); short int buf[N]; // loop over the file reading N samples at a time // long nitems_read; bool status = true; long i = 0; nitems_read = 1; for (i = 0;; i++) { // read the data // fprintf(stdout, "file pos = %d\n", ftell(fp)); nitems_read = fread(buf, sizeof(short int), N, fp); fprintf(stdout, "frame number %d: file pos = %d nitems_read = %d\n", i++, ftell(fp), nitems_read); if (nitems_read != N) { break; } // set status // if (nitems_read != N) { status = false; } } // close the file // fclose(fp); // exit gracefully // return 0; }