LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-24-2006, 10:43 AM   #1
fredyk_
LQ Newbie
 
Registered: Apr 2006
Posts: 6

Rep: Reputation: 0
Reading from stdin till eof stuck when sending multiple commands


Hi,

i have a C application called "read_stdin" that looks like:
while (!feof(stdin) && !ferror(stdin))
{
iSize = fread(szBuffer, sizeof(char), sizeof(szBuffer), stdin);
if (iSize>0)
{
fwrite(szBuffer, sizeof(char), iSize, stdout);
}
}

when sending some commands by 'paste' to the terminal, which ends with EOF sometimes the application gets stuck.
e.g. paste the 3 following command:

./read_stdin
abcd def feg


(last line is ^D to terminate the input. doesn't work even with 'regular' char like after running: stty eof 'k')

Any Ideas?
Thanks,
Fredy
 
Old 04-25-2006, 03:23 AM   #2
fredyk_
LQ Newbie
 
Registered: Apr 2006
Posts: 6

Original Poster
Rep: Reputation: 0
can someone please try it (to see if its only my linux)

thanks in advance,

Fredy
 
  


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
Send EOF to stdin? (C) smoothdogg00 Programming 3 03-07-2006 08:10 PM
sending at commands over pppoe? sti2envy Linux - Networking 3 10-18-2005 07:35 AM
java - reading from stdin greg108 Programming 4 01-13-2005 04:29 PM
sending windows commands from linux dubman Linux - Networking 1 11-13-2003 08:34 PM
sending telnet commands non-interactively JustinHoMi Linux - Networking 4 09-29-2001 02:20 PM


All times are GMT -5. The time now is 07:13 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration