Thread overview
writef bug?
Jul 08, 2004
Ivan Senji
Jul 08, 2004
Walter
Jul 08, 2004
Ivan Senji
Jul 08, 2004
Ivan Senji
Jul 09, 2004
Walter
Jul 09, 2004
Ivan Senji
Jul 09, 2004
Walter
Jul 09, 2004
Walter
writef bug? (date_t)
July 08, 2004
I import std.stdio;

and
writef("Hello");

gives me:

 Error 42: Symbol Undefined _D3std5stdio6writefFYv

when linking!

And i really wanted to figure out how this writef works!


July 08, 2004
"Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cck8ng$2mk4$1@digitaldaemon.com...
> I import std.stdio;
>
> and
> writef("Hello");
>
> gives me:
>
>  Error 42: Symbol Undefined _D3std5stdio6writefFYv
>
> when linking!
>
> And i really wanted to figure out how this writef works!

linux or windows? And is the 0.95 library installed?


July 08, 2004
"Walter" <newshound@digitalmars.com> wrote in message news:cckbdk$2qes$1@digitaldaemon.com...
>
> "Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cck8ng$2mk4$1@digitaldaemon.com...
> > I import std.stdio;
> >
> > and
> > writef("Hello");
> >
> > gives me:
> >
> >  Error 42: Symbol Undefined _D3std5stdio6writefFYv
> >
> > when linking!
> >
> > And i really wanted to figure out how this writef works!
>
> linux or windows? And is the 0.95 library installed?

WindowsXP, i did what i allways do: extract the new zip over
the old ones. The strange thing is that there is a _D3std5stdio6writefFYv
string in phobos.lib.

I just tried deleting my dm and dmd directories, an re-extracted the zip, and now it compiles and links, but when i run it i get "Test.exe is not a valid Win32 executable"

It may be that i am a little tired and doing something wrong, i'll try it on the other computer tomorow! :)





July 08, 2004
"Walter" <newshound@digitalmars.com> wrote in message news:cckbdk$2qes$1@digitaldaemon.com...
>
> "Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cck8ng$2mk4$1@digitaldaemon.com...
> > I import std.stdio;
> >
> > and
> > writef("Hello");
> >
> > gives me:
> >
> >  Error 42: Symbol Undefined _D3std5stdio6writefFYv
> >
> > when linking!
> >
> > And i really wanted to figure out how this writef works!
>
> linux or windows? And is the 0.95 library installed?
>

I tried it on the other computer and it works(sort of).
writefln does work ok
writef doesn't print anything with the same arguments!



July 08, 2004
I think this will be fixed when TypeInfo gets better, but right now:

date_t t = /* something */;
writef("%s",t);

Outputs the numeric representation of the date.

-----------------------
Carlos Santander Bernal


July 09, 2004
"Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cckk6p$602$1@digitaldaemon.com...
> "Walter" <newshound@digitalmars.com> wrote in message news:cckbdk$2qes$1@digitaldaemon.com...
> >
> > "Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cck8ng$2mk4$1@digitaldaemon.com...
> > > I import std.stdio;
> > >
> > > and
> > > writef("Hello");
> > >
> > > gives me:
> > >
> > >  Error 42: Symbol Undefined _D3std5stdio6writefFYv
> > >
> > > when linking!
> > >
> > > And i really wanted to figure out how this writef works!
> >
> > linux or windows? And is the 0.95 library installed?
> >
>
> I tried it on the other computer and it works(sort of).
> writefln does work ok
> writef doesn't print anything with the same arguments!

try an fflush(stdout) after the writef.


July 09, 2004
"Walter" <newshound@digitalmars.com> wrote in message news:ccl6v8$10k9$1@digitaldaemon.com...
>
>
> try an fflush(stdout) after the writef.

That works but that way i have to import both
std.c.stdio and std.stdio! I think i'll just stick with
the writefln (it is really nice by the way!)





July 09, 2004
"Ivan Senji" <ivan.senji@public.srce.hr> wrote in message news:cclcok$1919$1@digitaldaemon.com...
> "Walter" <newshound@digitalmars.com> wrote in message news:ccl6v8$10k9$1@digitaldaemon.com...
> >
> >
> > try an fflush(stdout) after the writef.
>
> That works but that way i have to import both
> std.c.stdio and std.stdio! I think i'll just stick with
> the writefln (it is really nice by the way!)

The flush is triggered by the output of '\n' when writing to a 'tty'. I'd just remembered that <g>, which is why the writefln worked for you. The output from writef will eventually appear. In fact, the behavior is the same as if you used a printf without a '\n'.



July 09, 2004
"Walter" <newshound@digitalmars.com> escribió en el mensaje
news:ccmgfa$2usm$3@digitaldaemon.com
| The flush is triggered by the output of '\n' when writing to a 'tty'. I'd
| just remembered that <g>, which is why the writefln worked for you. The
| output from writef will eventually appear. In fact, the behavior is the
same
| as if you used a printf without a '\n'.

What about this?

//////////
import std.date;
import std.stdio;
import std.c.stdio;

void main ()
{
    writefln("hi");
    fflush(stdout);
    d_time t = getUTCtime ();
    while ( getUTCtime() - t < 2 ) {}
    writef("bye");
}

//////////

Both "hi" and "bye" get printed at the same time (2 secs after the program
started). Tested on WinXP Pro and Win95 (yes, I'm currently using also 95).

-----------------------
Carlos Santander Bernal


July 09, 2004
"Carlos Santander B." <carlos8294@msn.com> wrote in message news:ccn4oq$rbi$1@digitaldaemon.com...
> "Walter" <newshound@digitalmars.com> escribió en el mensaje
> news:ccmgfa$2usm$3@digitaldaemon.com
> | The flush is triggered by the output of '\n' when writing to a 'tty'.
I'd
> | just remembered that <g>, which is why the writefln worked for you. The
> | output from writef will eventually appear. In fact, the behavior is the
> same
> | as if you used a printf without a '\n'.
>
> What about this?
>
> //////////
> import std.date;
> import std.stdio;
> import std.c.stdio;
>
> void main ()
> {
>     writefln("hi");
>     fflush(stdout);
>     d_time t = getUTCtime ();
>     while ( getUTCtime() - t < 2 ) {}
>     writef("bye");
> }
>
> //////////
>
> Both "hi" and "bye" get printed at the same time (2 secs after the program
> started). Tested on WinXP Pro and Win95 (yes, I'm currently using also
95).

Windows is a multithreaded operating system, and while your program is hung in a tight loop, it is probably preventing other threads from running, like the thread that updates the console window.