Note that there are some explanatory texts on larger screens.

plurals
  1. POC program not entering for loop, but executing everything right up until it
    primarykey
    data
    text
    <p>for some reason when running a program it refuses to enter a for loop, and rather just hangs. </p> <pre><code>main() { char *buffer; int chunk_offset, current_chunk_number, total_chunks; int filelen; filelen = ReadFileintoBuffer( buffer); printf("file read \n"); // error break point 1 int events = filelen/eventlen; // number of 512 + 2 32 bit events events with timecode int sp = 0; int i,j; int toterror[25]; printf("file of length %d has %d events \n", filelen, events); printf(" i = %d \n", i); for( i = 0; i &lt; events; i++) { printf("analyzed %d events of %d", i, events); sp=0; int error[13]; Analyzeevent(buffer+i*eventlen, error); if(error[0]) { sp = 12; } for( j =1; j &lt; 13; j++) { toterror[j+sp] += error[j]; } } printf("post for loop"); Printerrs(toterror, events); exit(0); } </code></pre> <p>It prints everything down to i = (9727988 in this particular case), then nothing. it all just stops. any idea what happened? i learned c++ and programming in c is very strange and awkward for me right now. compiler doesnt throw up any warnings or anything</p> <p>thank you for your help in advance.</p> <p>edit: for ring0 heres the code to ReadFileintoBuffer:</p> <pre><code>int ReadFileintoBuffer( char *buffer) { int filelen; char text[200]; printf("Input File: " ); scanf( "%s" ,text); FILE *file = 0; int i; //Open file file = fopen(text, "rb"); if (!file) { fprintf(stderr, "Unable to open file \n"); exit(0); } //Get file length fseek(file, 0, SEEK_END); // find the end of the file filelen=ftell(file); // set the current pointer (currently at end from above) as file length fseek(file, 0, SEEK_SET); // set pointer back to beginning of file //Allocate memory buffer=(char *)malloc(filelen+1); if (!buffer) { fprintf(stderr, "Memory error! \n"); fclose(file); return; } //Read file contents into buffer fread(buffer, filelen, 1, file); fclose(file); // clse the file, all in buffer now return filelen; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload