lists.zerezo.com



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** Re: [Mingw-users] ANSI escape sequences problem



Hi,

I have tried 2 and 3 since I'm limited to the MinGW lib in cygwin. Neither worked and it still buffers and fgetc, fread or read still return when the first enter is pressed. I used setvbuf as 
if (setvbuf(stdin, NULL, _IONBF, 0) == 0)
{
	// carry on
...

I have tried to google for more information and termios.h did show up a lot but since this is not available on MinGW there should be another way to get this to work. I tested the buffer stuff running both on bash and rxvt.

/Bengt


-----Original Message-----
From: mingw-users-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:mingw-users-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Brian Dessent
Sent: den 24 juni 2008 12:54
To: MinGW Users List
Subject: Re: [Mingw-users] ANSI escape sequences problem

Bengt Werstén wrote:

> That did clear some part. The pseudo terminal concept was new for me although I have used it but without realizing how it actually worked. I still feel like some parts are a bit unclear. The main problem now is how do I disable all the IO buffering?

Well, it depends on what IO abstraction level you're using.  There are
at least four that come to mind off the top of my head:

1. The Win32 API level, using HANDLES, e.g. ReadFile/WriteFile.
2. The C runtime level, using file descriptors, e.g. read/write.
3. The C runtime level, using C streams (FILE *), e.g. fread/fwrite.
4. The C++ runtime level, using iostream, e.g. cin/cout.

For (3) you can disable buffering with setvbuf() with _IONBF.  For (4)
you can control buffering with foo.rdbuf()->pubsetbuf(0, 0), I think. 
(1) and (2) are AFAIK direct in that they read or write as many bytes as
specified in the call without any buffering.

Brian

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users