469,300 Members | 2,190 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,300 developers. It's quick & easy.

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

175 100+
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???
Feb 27 '08 #1
2 2283
manontheedge
175 100+
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...

Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <stdio.h>
  3. #include <sys/types.h>
  4. #include <unistd.h>
  5. #include <signal.h>
  6.  
  7.  
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.
Feb 27 '08 #2
weaknessforcats
9,208 Expert Mod 8TB
Let's see your printf() and the specific errors you are getting.
Feb 27 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Kornelius Finkenbein | last post: by
5 posts views Thread by Gregory | last post: by
10 posts views Thread by Carlos Ribeiro | last post: by
4 posts views Thread by Davy | last post: by
5 posts views Thread by msigwald | last post: by
14 posts views Thread by stevek | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.