471,895 Members | 2,330 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,895 software developers and data experts.

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 2359
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
  2. #include <stdio.h>
  3. #include <sys/types.h>
  4. #include <unistd.h>
  5. #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.
Feb 27 '08 #2
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 YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.