By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
461,970 Members | 595 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 461,970 IT Pros & Developers. It's quick & easy.

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

P: 175
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
Share this Question
Share on Google+
2 Replies

P: 175
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

Expert Mod 5K+
P: 9,197
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.