LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-04-2003, 10:33 PM   #1
raptorsoft2000
LQ Newbie
 
Registered: Aug 2003
Posts: 6

Rep: Reputation: 0
What is a newline?


I have been using linux now for 2 months, but i just started in C. When compiling with GCC, i get this error:

"warning: no newline at end of file"

this is probably an easy answer, but i would appreciate any help.

thanks
 
Old 08-04-2003, 10:37 PM   #2
ksgill
Senior Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044

Rep: Reputation: 45
http://www.linuxquestions.org/questi...002/03/2/16122
 
Old 08-04-2003, 10:40 PM   #3
raptorsoft2000
LQ Newbie
 
Registered: Aug 2003
Posts: 6

Original Poster
Rep: Reputation: 0
I looked at that page, and it tells why i need a newline, but i still dont know, "what is a newline?"

what would i have to do just to fix the stupid thing?

thanks!
 
Old 08-04-2003, 10:46 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,266

Rep: Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624
Move the cursor down to the right of the last character of the last line of text and press the enter key.

Save file and compile.
 
Old 08-04-2003, 10:49 PM   #5
ksgill
Senior Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044

Rep: Reputation: 45
Newline = new line, as simple as that. it means that theres no new line after the last line of your code. Your application expects to find a new line after every line and when it doesnt it issues a warning.
 
Old 08-04-2003, 10:56 PM   #6
ksgill
Senior Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044

Rep: Reputation: 45
____________________________________________________
quote:
It means that theres no new line after the last line of your code
____________________________________________________
I meant the text file you are reading from.
 
Old 08-04-2003, 11:05 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,266

Rep: Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624
In other words
An End Of Line character in linux is the 0x0A. The end of file marker is CTRL-Z character. NO newline at end of file means there isn't a EOL character between the last character of text and the end of file marker.

Everytime you press the Enter key a 0x0A character is placed in the file. This tells the editor to move the cursor to the beginning of the next line.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cat 2 files without newline lea Programming 5 12-23-2010 04:54 PM
newline problem harrylmh Programming 4 11-21-2005 05:04 AM
php + newline??? blizunt7 Programming 1 06-20-2005 12:44 AM
Newline in xmessage? scottjwoodford Linux - General 2 06-09-2005 04:17 PM
Removing newline. Tarts Programming 2 10-16-2003 12:49 PM


All times are GMT -5. The time now is 07:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration