Sender: tim AT picard DOT skynet DOT be Message-ID: <3B1C7589.E93D071F@falconsoft.be> Date: Tue, 05 Jun 2001 08:00:41 +0200 From: Tim Van Holder Organization: Falcon Software NV X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.16-3 i686) X-Accept-Language: en, nl-BE, nl MIME-Version: 1.0 To: "John H.T. HO" , djgpp AT delorie DOT com Subject: Re: Reopen stdout in binary mode References: <9fhr5s$79u AT netnews DOT hinet DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com "John H.T. HO" wrote: > > Hi all, > > I am developing a program which concatenates 3 object files and do some > operation on it. In my program, I write the result data to "stdout" and then > redirect it to a destination file under bash while the program is executing. > > bash$ concate file1 file2 file file3 > destfile > > Is there a way to reopen the "stdout" in binary mode? Or just treat my > destination file as the 4th parameter and open it in binary mode explicitly? > Use setmode() to set the file descriptor to binary mode. See the libc reference for info on setmode(). If sending binary data to the console is unwanted (it probably is), you may want to use isatty() first (and possible exit the program if stdout is a tty). -- Tim Van Holder - Anubex N.V. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This message was posted using plain text. I do not endorse any products or services that may be hyperlinked to this message.