I am running a program within another and reading the output. My problem
is that all outputs are delayed because of bufferring
Can I tell printf to print all outputs immediately and not buffer it
Thanks
Ram 4 8333
In article <bt************@ID-166953.news.uni-berlin.de>,
Ramprasad A Padmanabhan <ra*******@netcore.co.in> wrote: I am running a program within another and reading the output. My problem is that all outputs are delayed because of bufferring
Can I tell printf to print all outputs immediately and not buffer it
You can flush the output buffer of printf(), see: http://www.eskimo.com/~scs/C-faq/q12.4.html
Regards,
--
Rob van der Leek | rob(at)ricardis(dot)tudelft(dot)nl
Ricardishof 73-A | http://www.ricardis.tudelft.nl/~rob
2614 JE Delft, The Netherlands
+31 (0)6 155 244 60
On Mon, 12 Jan 2004 13:53:17 +0530, Ramprasad A Padmanabhan
<ra*******@netcore.co.in> wrote: I am running a program within another and reading the output. My problem is that all outputs are delayed because of bufferring
Can I tell printf to print all outputs immediately and not buffer it
you can make 'stdout' unbuffered by using 'setvbuf()' with _IONBF flag.
For more into see 'man setvbuf'
--
Mohan
"A. J. Mohan Rao" <aj*********@fth7.siemens.de> wrote: On Mon, 12 Jan 2004 13:53:17 +0530, Ramprasad A Padmanabhan <ra*******@netcore.co.in> wrote:
I am running a program within another and reading the output. My problem is that all outputs are delayed because of bufferring
Can I tell printf to print all outputs immediately and not buffer it you can make 'stdout' unbuffered by using 'setvbuf()' with _IONBF flag.
s/make/try to make/. There's no guarantee that it works. Even when
setvbuf() returns 0 (success), that only means that the C implementation
doesn't buffer stdout any more; the OS still might, and there might be
nothing you can do about it. But yes, setvbuf() is the function to try -
or setbuf(stdout, 0), which amounts to the same thing.
For more into see 'man setvbuf'
Or, indeed, your C book, which is more likely to be ISO-compatible.
Richard
"A. J. Mohan Rao" <aj*********@fth7.siemens.de> wrote: On Mon, 12 Jan 2004 13:53:17 +0530, Ramprasad A Padmanabhan <ra*******@netcore.co.in> wrote:
I am running a program within another and reading the output. My problem is that all outputs are delayed because of bufferring
Can I tell printf to print all outputs immediately and not buffer it
you can make 'stdout' unbuffered by using 'setvbuf()' with _IONBF flag. For more into see 'man setvbuf'
Well, we're deep in implementation defined land here
[C99 7.19.3#3], so the suggested setvbuf call might
fail on some implementations.
Regards
--
Irrwahn Grausewitz (ir*******@freenet.de)
welcome to clc : http://www.ungerhu.com/jxh/clc.welcome.txt
clc faq-list : http://www.eskimo.com/~scs/C-faq/top.html
acllc-c++ faq : http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: shyren |
last post by:
Hi All,
I have a php program which calls a c++ program using exec. However when
user presses stop button in the browser or closes it this program keeps
on running on the server. How can I stop it...
|
by: dh |
last post by:
Runtime.getRuntime().exec() ... mad buffering of stdout ...
It buffers stdout without limit ...
so if your Java program doesn't keep up with the Process output then
memory fills up!
I wish it...
|
by: hokiegal99 |
last post by:
How can I make this script run w/o seeing a cmd popup window on the
screen? The script works well, but each hour (when the task scheduler
runs it) a brief cmd window appears and then goes away....
|
by: BS |
last post by:
Hi All,
This may be an old question, but there's little useful references online
that I've been able to find.
I want the following code to display bit by bit, not send all at once to the...
|
by: midday.hu |
last post by:
Hi,
Does someone know how to stop "the information output on screen"? Now
when I run my code, it outputs a lot of message when calling other
libraries, together with the info with the print...
| |
by: SS |
last post by:
It seems that my code locks my machine up after the " fclose(datafile);"
command
I guess I'm not following the next bit of code on properly.
Can someone help me out??
SS...
|
by: siliconwafer |
last post by:
Hi All,
I want to know tht how can one Stop reading a file in C (e.g a Hex
file)with no 'EOF'?
|
by: Santtu Nyrhinen |
last post by:
Hi,
Let say that I have a function like
void writeHello() {
printf("Hello");
}
Now I need to make an automated test fot that function.
The test function returns 1 for successful and 0 for...
|
by: CC |
last post by:
Hi:
I've conjured up the idea of building a hex line editor as a first real
Python programming exercise.
To begin figuring out how to display a line of data as two-digit hex
bytes, I created...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |