Re: [cc65] C64: CKOUT followed by printf

From: Oliver Schmidt <ol.sc1web.de>
Date: 2010-12-03 12:14:56
Hi Groepaz,

>> I placed a (printf) debug message directly following a call to
>> cbm_k_ckout(lfn_serial). What seemed to happen was the debug message
>> went to the screen, and so did the character I sent after that using
>> BSOUT, that was intended to go to the lfn_serial device.

> you can not mix calls to the posix standard functions and arch dependend stuff
> like the cbm_ functions. so yes, what you say is what happens :) if you want
> to "printf" to a file, use fopen and fprintf. (or well, hack your own stuff
> with sprintf if you like to reinvent the wheel =P)

Hm, isn't printf() supposed to write to the 'standard output' ? And
isn't the enviroment the program runs in free to decide where that
standard output should actually go (i.e. a shell redirecting the
standard output to some file/device) ?

Again, I'm no C64 guy so I don't actually know, but... in case
cbm_k_ckout() could be considered the C64 way to decide where the
standard output goes then I *WOULD* expect printf() to write to that
location.

BTW: The Apple2 printf() does it this way: If you modify CSW ("Console
Switch") at $36/$37 then that changes the behaviour of printf() in the
same way it changes the behaviour of a BASIC PRINT statement. This way
you can printf() to serial lines, printers, <you name it>. On the
other hand cprintf() always goes straight to the screen.

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Dec 3 12:16:27 2010

This archive was generated by hypermail 2.1.8 : 2010-12-03 12:16:29 CET