From: zappaz AT xtra DOT co DOT nz Newsgroups: comp.os.msdos.djgpp Subject: Why why why??? (help me with this code....) Date: Sun, 22 Mar 1998 09:16:19 GMT Organization: Customer of Telecom Internet Services Lines: 36 Message-ID: <6f0c4b$a9p$1@wolfman.xtra.co.nz> NNTP-Posting-Host: p40-m13-mdr1.dialup.xtra.co.nz To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I'm using DJGPP on Win95 platform and this little procedure is giving me a real headache. All it does is return a frequency table (array of longs) of how often each byte appears in the file "namein". If I include the line marked with ' > ' then the following while loop never gets executed. ? Also, if I include the line marked with ' >>> ' the program crashes, even if the ' > ' line _is_ included. ? ? Compiles OK. long *frequencyTable(char *namein) { FILE *infile; int c; long *freq; memset(freq,0,2); infile = fopen(namein,"r"); printf("Opening %s successful.\n", namein); > for (int i=0;i<256;i++) freq[i]=0; while((c=getc(infile))!=EOF) { printf("got \"%c\"\n",c); // not really neccesary >>> freq[c]++; } fclose(infile); return freq; } Also, I've often noticed that adding a printf statement in a loop makes a big difference to how that loop runs (usually the difference between running or not running at all). Is this just something strange with DJGPP or is there something I don't know? Thanks in advance, Chris.