November 14, 2002
I don't wanna send it to a file, I wanna send it to OutputDebugString so it shows up in the debugger Output window.  Is that so much to ask?

I'm just gonna have to make my own printf function based on sprintf, aren't I?

Windows is so screwed up.

Sean

"Richard Krehbiel" <rich@kastle.com> wrote in message news:ar0gsi$1jg7$1@digitaldaemon.com...
> What you want is freopen, for example freopen("redirect_stdout.txt","w",
> stdout);
>
> It's even in the C standard.  (I'm kinda surprised you forgot about this,
> Walter.)


November 14, 2002
vsprintf, actually.  Ugly :(

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]


November 15, 2002
Right.  Oops!  Well that's the way I've always done it in C++ (Usually,
"void DebugPrintf(const char*,...);"), why should D be any different?

I thought Windows apps stubbed out the stdin/stdout/stderr handles;  I wasn't aware you could redirect to a file.  Good to know.  Still it seems to make sense to me that if you don't have a console, the output should go somewhere useful (OutputDebugString) instead of to dev/nul.  Otherwise newbies will printf a bunch of stuff and wonder why it doesn't show up anywhere.

Maybe someone could make a redirector that dumps all of stdin to OutputDebugString, and pipe the app to that.  Sounds easy enough but it seems like there might be a process boundary issue.  Only one way to find out!

Sean

"Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3DD4169B.BFD7E96E@deming-os.org...
> vsprintf, actually.  Ugly :(


November 21, 2002
I rarely bother with stdio. I tend to use a different set of functions that call Windows directly.

"Richard Krehbiel" <rich@kastle.com> wrote in message news:ar0gsi$1jg7$1@digitaldaemon.com...
> What you want is freopen, for example freopen("redirect_stdout.txt","w",
> stdout);
>
> It's even in the C standard.  (I'm kinda surprised you forgot about this,
> Walter.)
>
> "Lloyd Dupont" <lloyd@galador.net> wrote in message news:aqv9cj$81f$1@digitaldaemon.com...
> > Walter wrote:
> >
> > > Not that I know of. I've always thought that was a curious bug in
> Windows.
> > >
> > > "Sean L. Palmer"  wrote in message news:aqt2bc$5jv$1@digitaldaemon.com...
> > >
> > > >So how do we redirect printf from inside the program?  Is there a
hook?
>
> --
> Richard Krehbiel, Arlington, VA, USA
> rich@kastle.com (work) or krehbiel3@comcast.net  (personal)
>
>
>
>


November 21, 2002
I have my own that writes to a log file. Each line is flushed and the file closed, so that it is uptodate before the program crashes. I find it invaluable <g>, and not just for windows. I've used it for shared dlls under linux, too, where I had no control over stdout.

"Sean L. Palmer" <seanpalmer@directvinternet.com> wrote in message news:aqvkt8$khi$1@digitaldaemon.com...
> Sounds like printf isn't all that, after all.  ;(
>
> Sean
>
> "Walter" <walter@digitalmars.com> wrote in message news:aqua4e$283n$2@digitaldaemon.com...
> > Not that I know of. I've always thought that was a curious bug in
Windows.
> >
> > "Sean L. Palmer" <seanpalmer@directvinternet.com> wrote in message news:aqt2bc$5jv$1@digitaldaemon.com...
> > > So how do we redirect printf from inside the program?  Is there a
hook?
> > >
> > > Sean
> > >
> > > > I have no idea. I just use regular printf's and redirect the output
to
> a
> > > > file. For a GUI app I have a printf that logs to a text file.
> > > >
> > > > > I have a question... does printf show up in the Output log window
> (via
> > > > > OutputDebugString) if you don't have a console open?
> > > > >
> > > > > Sean
>
>


1 2
Next ›   Last »