Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dddddd

macrumors newbie
Original poster
Nov 8, 2005
1
0
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 -
Daniel
 

superbovine

macrumors 68030
Nov 7, 2003
2,872
0
libraries and compilers are quite different between windows dev studio and gcc. post your code snippet and the full error message.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.