Re: [cc65] gets() in infinite loop

From: Ullrich von Bassewitz <>
Date: 2012-06-07 14:21:02
On Tue, Jun 05, 2012 at 08:50:28PM -0500, Payton Byrd wrote:
>    I'm not using the posix file functions,
>    but the cbm_* stuff, so I wouldn't expect stdin to be affected.

As has already been said, this expectation is false for the CBMs. Without
additional code for tracking CBM file numbers, there is no way for the runtime
to know which ones are in use and which ones aren't.

For the cbm_* stuff, file numbers are passed by the programmer, while for the
POSIX style functions (on which C stream I/O is based), the library manages
them automatically. So there is a high chance for collisions. Which in turn
leads to the strong suggestion you have already heard: Don't mix the two.

Please note that - contrary to popular belief - gets and printf are C stream
I/O functions. They use the file handles for stdin and stdout respectively,
which are opened automatically by the runtime when these functions are linked
to the executable.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Jun 7 14:21:10 2012

This archive was generated by hypermail 2.1.8 : 2012-06-07 14:21:13 CEST