473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 2447
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

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

Similar topics

7
by: Kornelius Finkenbein | last post by:
Hello folks! I've got a strange problem with my download-script in conjunction with M$ internet explorer, if the filename I want to link to includes more than one points. In Netscape the problem...
5
by: Gregory | last post by:
I am working through the exercises in the book "Learning PHP 5". I am using OS 10.3.7, with Apache, Safari and IE. When I execute the following code, the newline "\n" does not work. The ouput is...
2
by: inonzuk | last post by:
why strange you ask? here goes: I have been working with Php and Mysql for a week without any problems. Today I tried executing a php page that connects to mysql and creates a new database, I...
10
by: Carlos Ribeiro | last post by:
Hello all. I'm sending this to the list because I would like to know if someone else has ever stumbled across this one, and also because one possible solution is to patch, or simply "decorate",...
2
by: Olaf | last post by:
I have a frameset page witch contains the myFuc() function. The function is accessed from a page in one of the frames in the frameset. An example is shown below. <input...
4
by: Davy | last post by:
Hi all, I am reading a book "Computer Systems A progammer's Perspective"( http://csapp.cs.cmu.edu/public/students.html ). The book have a chapter talking about Memory and have a sample program(...
5
by: msigwald | last post by:
I'm trying to write a little C program to run under linux, which must gain root so it can then shutdown the computer. I can get the code to execute the su command via system("su"), but once su...
14
by: stevek | last post by:
Following code does not produce any new lines. Any ideas. echo "This spans\multiple lines. The newlines will be\noutput as well.";
2
by: tvnaidu | last post by:
valgrind error - "failed to start tool 'memcheck' for platform x86-linux" no such file or dir copied all lib and bin files which are generated after I compiled valgrind package, when I run my exe...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.