English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 22 September 2018, 17:32   #1
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,207
console and buffered i/o

I've found some behavior i can't explain (note : tests made under V39).

If i do :
. Open() with some CON: for opening my console window
. FPutS() to write some string (without lf)
. FGetS() to get some input
Then it works fine.

But if i do :
. PutStr() to write some string (again without lf)
. Input() to get the input handle
. FGetS() to get some input
Then the string isn't displayed properly unless i call Flush() before FGetS().
(Or, of course, i put lf or even cr at the end of said string but this does not give the intended result.)

The question now is why.
As docs explicitly document both FPutS() and PutStr() as buffered, same for FGetS(), there should be no need to flush the file handle.
So what ???
meynaf is offline  
Old 26 September 2018, 14:15   #2
Krashan
Hardware Designer

 
Join Date: Aug 2018
Location: Bialystok/Poland
Age: 45
Posts: 12
Well, PutStr() is buffered, so to see its output you have to:
1. Fill up the whole buffer, or...
2. Send a LF, or...
3. Call Flush() on default output.
Krashan is online now  
Old 26 September 2018, 17:51   #3
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,207
Quote:
Originally Posted by Krashan View Post
Well, PutStr() is buffered, so to see its output you have to:
1. Fill up the whole buffer, or...
2. Send a LF, or...
3. Call Flush() on default output.
Not an explanation. FPutS() is also buffered and i do see its input without filling the buffer, sending lf, or calling Flush().
meynaf is offline  
Old 27 September 2018, 10:12   #4
Krashan
Hardware Designer

 
Join Date: Aug 2018
Location: Bialystok/Poland
Age: 45
Posts: 12
It may be different buffer size or buffering mode. Buffered I/O handle can still have BUF_NONE mode set.
Krashan is online now  
Old 27 September 2018, 10:53   #5
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,207
Different buffer size, does it change something for writing just 10 characters ? No buffer would be that small.
Different buffering mode, sorry, but it does not behave differently if no input is made.

It may be that FGetS() does a flush on the passed handle.
But on the cli window, Input and Output are different handles so flushing the input has no effect.
meynaf is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
4 way buffered IDE adaptor ??? piemmeweb support.Hardware 66 27 June 2012 22:35
Amigakit's 4 Way Buffered IDE fitzsteve support.Hardware 2 29 April 2010 11:42
4xEIDE'99 Buffered Interface ? blade002 MarketPlace 29 07 March 2007 16:18
4-Way Buffered IDE Interface DDNI support.Hardware 8 30 June 2006 11:35
EZCD-SE 4-way Buffered...Help ! Unregistered support.Hardware 15 09 May 2004 10:41

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 On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.06736 seconds with 15 queries