April 26, 2024, 08:34:57 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Anyone have a solution... piping printf

Started by Parker, March 15, 2006, 03:02:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Parker

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

Ionic Wind Support Team

Yeah.  Use real pipes, sprintf and WriteFileA to the pipe.   It's the only way ;)
Ionic Wind Support Team

Parker

March 15, 2006, 03:28:30 PM #2 Last Edit: March 15, 2006, 03:30:11 PM by Parker
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.

Ionic Wind Support Team

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.
Ionic Wind Support Team

Parker

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