View Full Version : Bus Error?!

Nov 8, 2005, 03:42 PM
Hello -

I have started coding C since September and am trying to compile a program which works as a very rudimentary code breaker (utilizing english language letter frequencies).

I have managed to find the letter frequencies of a document and sort them - but was trying to find a way to read the input (which was originally stdin from the keyboard) a second time in order to replace the original letters with new letters.

It was suggested that I read from a second file in the same directory using fopen and fgetc to read it - but when i try that I am getting a bus error. Yet it seems to work when compiled on a windows system. What might I be doing wrong? I can send the code if that is helpful.

Thanks -

Nov 8, 2005, 03:44 PM
libraries and compilers are quite different between windows dev studio and gcc. post your code snippet and the full error message.

Nov 8, 2005, 05:01 PM
A bus error is basically a memory error. You are probably either trying to read memory you have freed or you are reading past the end of a buffer you have allocated.

Nov 8, 2005, 07:42 PM
Yes, it is memory referencing problem