LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 09: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, 09: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, 09: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, 09:46 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,696

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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, 09: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, 09: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, 10:05 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,696

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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



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 03:54 PM
newline problem harrylmh Programming 4 11-21-2005 04:04 AM
php + newline??? blizunt7 Programming 1 06-19-2005 11:44 PM
Newline in xmessage? scottjwoodford Linux - General 2 06-09-2005 03:17 PM
Removing newline. Tarts Programming 2 10-16-2003 11:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:07 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
Open Source Consulting | Domain Registration