LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-30-2004, 06:19 PM   #1
xviddivxoggmp3
Member
 
Registered: Feb 2004
Location: scanf
Distribution: Redhat Enterprise 4.4 AS
Posts: 236

Rep: Reputation: 30
Question eof ... c ... linux


what is the eof character for linux?
windows it is Ctrl z.
 
Old 03-30-2004, 06:31 PM   #2
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
Ctrl+d

Lyle
 
Old 03-30-2004, 06:32 PM   #3
kooch
Member
 
Registered: Mar 2004
Location: Upstate NY
Distribution: Slackware/YDL
Posts: 77

Rep: Reputation: 15
Try Ctrl-D

In a C program it's a implementation defined constant for stdio functions. For system calls it is 0 on linux.
 
Old 03-30-2004, 11:18 PM   #4
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
C returns EOF as -1 decimal or 0xFFFFFFFF hex. In a shell, CTRL-D issues a EOF character.
 
Old 03-31-2004, 12:04 AM   #5
kooch
Member
 
Registered: Mar 2004
Location: Upstate NY
Distribution: Slackware/YDL
Posts: 77

Rep: Reputation: 15
What the hell was I thinking when I said system calls return 0 on error?
Pfffft /me puts the crack pipe down.

For standard i/o functions do you really want to rely on -1 being EOF? I always compare the return value against EOF, which depending on implementation is not necessarily -1.
 
Old 03-31-2004, 01:19 AM   #6
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
Well he asked what the EOF return value was in linux, and it is defined as (-1) in the linux standard headers.
 
Old 03-31-2004, 12:56 PM   #7
kooch
Member
 
Registered: Mar 2004
Location: Upstate NY
Distribution: Slackware/YDL
Posts: 77

Rep: Reputation: 15
I guess I've been reading too much comp.lang.c
 
  


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
EOF finding Goblin_C_Noob Programming 7 09-10-2005 09:58 AM
Premature EOF? miknight Programming 1 04-04-2004 12:19 AM
Question about EOF (C) xailer Programming 6 12-07-2003 11:15 AM
<< Eof ? sikandar Linux - Software 5 09-18-2003 11:39 AM
End Of File Key (EOF) in linux ereeno Linux - Software 3 08-05-2003 03:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:36 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