Linux strange newline "\n" problem - messes up program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manontheedge
    New Member
    • Oct 2006
    • 175

    #1

    Linux strange newline "\n" problem - messes up program

    I'm getting weird results in my program, and even compile time errors, and I've got it down to the "\n" command I use in "printf()".

    The program this is happening in deals with multiple processes, so I'm forking and killing processes during the program. The code runs perfectly fine, UNTIL I try to use printf() with ANYTHING containing "\n" ... doesn't matter how many of them there are in the printf() statement, it always either gives a compile time error or causes really strange program errors during run time.

    I'm fairly new to Linux ... is there something I don't know about using the newline character causing weird glitches???
  • manontheedge
    New Member
    • Oct 2006
    • 175

    #2
    I actually just realised that the problem doesn't have to do with the newline character, it has to do with the include files I'm using...

    Code:
    #include <stdio.h>
    #include <sys/types.h>
    #include <unistd.h>
    #include <signal.h>
    if I have multiple words inside the printf() statement I get compile time errors. Why is this happening? Is "signal.h" messing something up? I'm using "signal.h" because I'm using the KILL command in my code.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      Let's see your printf() and the specific errors you are getting.

      Comment

      Working...