Bus Error?!

Discussion in 'Mac Programming' started by dddddd, Nov 8, 2005.

  1. dddddd
    Expand Collapse
    macrumors newbie

    Nov 8, 2005
    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 -
  2. superbovine
    Expand Collapse
    macrumors 68030


    Nov 7, 2003
    libraries and compilers are quite different between windows dev studio and gcc. post your code snippet and the full error message.
  3. robbieduncan
    Expand Collapse
    Moderator emeritus


    Jul 24, 2002
    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.
  4. brendel95
    Expand Collapse
    macrumors regular

    May 23, 2005

Share This Page