LinuxQuestions.org
Help answer threads with 0 replies.
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 04-04-2004, 01:00 AM   #1
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
Question Premature EOF?


Hi guys,

I have some code which needs to transfer binary files to a remote server. My problem is, as I read the file from my local machine as I perform the transfer, I get a premature EOF so only a small part of the file is actually transferred.

My loop is as follows:
Code:
while ((c = fgetc(fs)) != EOF) {
I checked the last few bytes that I transfer and they are 00 FF. Could the FF be being interprested as EOF? If so, if there a way around this?

Thanks for any help!
 
Old 04-04-2004, 01:19 AM   #2
miknight
Member
 
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Original Poster
Rep: Reputation: 30
Woops figured it out. Since c was a char it couldn't test for EOF properly. I used an int instead and just casted it later.
 
  


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
Premature end of script headers bhomass Debian 1 12-02-2005 06:31 PM
Premature firewall script metallica1973 Linux - Security 2 09-17-2005 02:21 PM
Perl/CGI Problem "Premature Premature end of script headers: countdown.pl" newuser455 Linux - Software 2 07-18-2004 12:47 PM
Premature Script Failure Alan Powell Linux - Newbie 3 04-15-2004 02:00 PM
<< Eof ? sikandar Linux - Software 5 09-18-2003 12:39 PM

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

All times are GMT -5. The time now is 11:54 AM.

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