digitalmars.D.learn - writef / writefln and passing output to a file
- jicman (25/25) Mar 23 2005 Greetings!
- Walter (6/6) Mar 23 2005 Output going to the console is flushed every time a \n is written. If th...
- jicman (3/9) Mar 24 2005 Yeah, but I don't use printf. :-) Ok, thanks.
- Carlos Santander B. (4/22) Mar 24 2005 After writef will also work.
Greetings! Let us imagine that I have a program call prog.exe. When I run that program I get some output on the screen and then it goes and grabs a bunch of xml from a server and does some things. While grabbing all of these xml data, there is a big pause, but nonetheless, the are headings and information printed before this pause. For example <example out> c:\> prog.exe arg1 arg2 arg3 Program Version 1.0.19 Login on to server arg1 Login on using user arg2 Date: <%date%> Blah blah blah Waiting for data from arg1... </example out> Ok, so this shows right away after running the program. but if I run the same command above and I want the output to go to a file, i.e. c:\> prog.exe arg1 arg2 arg3 > out.txt that information is kept for a while and later flushed with more data. The question is: 1. Is this Windows or D? (I know it's probably waiting for a certain amount of bytes to write it to the file, but is this Windows or D?) I have an idea, but I want you smart-a-lics to take me to the promised land. thanks, josé
Mar 23 2005
Output going to the console is flushed every time a \n is written. If the output is going to a file, it is flushed whenever the default file buffer gets filled up. But you can force a flush by adding: std.c.stdio.fflush(stdout); after a printf.
Mar 23 2005
Walter says...Output going to the console is flushed every time a \n is written. If the output is going to a file, it is flushed whenever the default file buffer gets filled up.This is the OS file buffer, right? Not D's, correct?But you can force a flush by adding: std.c.stdio.fflush(stdout); after a printf.Yeah, but I don't use printf. :-) Ok, thanks.
Mar 24 2005
jicman wrote:Walter says...After writef will also work. _______________________ Carlos Santander BernalOutput going to the console is flushed every time a \n is written. If the output is going to a file, it is flushed whenever the default file buffer gets filled up.This is the OS file buffer, right? Not D's, correct?But you can force a flush by adding: std.c.stdio.fflush(stdout); after a printf.Yeah, but I don't use printf. :-) Ok, thanks.
Mar 24 2005