IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Parker on March 15, 2006, 03:02:37 PM

Title: Anyone have a solution... piping printf
Post by: Parker on March 15, 2006, 03:02:37 PM
I have a little problem having to do with piping printf()'s output. The problem is, it seems printf() or fprintf() keeps its own buffer, so sometimes it doesn't pipe correctly. I can fix it by inserting a fflush() call in the C program, but that doesn't help from the Aurora side where I'm trying to pipe it to.

So... the question is, does anyone know how I can make it work? It seems FlushFileBuffer doesn't do anything...
Thanks,
Parker
Title: Re: Anyone have a solution... piping printf
Post by: Ionic Wind Support Team on March 15, 2006, 03:21:06 PM
Yeah.  Use real pipes, sprintf and WriteFileA to the pipe.   It's the only way ;)
Title: Re: Anyone have a solution... piping printf
Post by: Parker on March 15, 2006, 03:28:30 PM
The C program is the compiler though ;) Or does fprintf use a different mechanism? It pipes the output correctly with an Aurora program, and also with the linker.
Title: Re: Anyone have a solution... piping printf
Post by: Ionic Wind Support Team on March 15, 2006, 03:51:40 PM
fprintf writes to an open file handle. 

Maybe with a little better description of what your trying to do.  If your trying to emulate what the IDE does then you'll need to read up on Windows pipes and access rights.  It's not as easy as one might think to read the output of a console application from within a Windows app.

If that is what your trying to let me know and I'll share my CProcess class (C code but you can convert) in the private developers area.
Title: Re: Anyone have a solution... piping printf
Post by: Parker on March 15, 2006, 03:54:56 PM
Yes, that's what I'm trying to do. Almost exactly what the IDE does, it's a utility that handles all the compilation so it's easy to use on the command line, like how you can just do
gcc something.c
my utility will hopefully be able to do
aec something.src
and produce something.exe