[cc65] Reading a string from an open file under cc65?

From: <Maspethrose71aol.com>
Date: 2008-12-27 17:51:45
I use the following code to read the error channel of a CBM drive.   Escuse 
the commented code: I use it for testing:
 
--------------------------------------------
unsigned char diskerror ()
{
unsigned char i=0;  /*  Loc. in channel. */
char errch [32];  /* Returned error.  */
/* Read error channel from drive 8. */
printf ("Open  returns:  %d.\n", (unsigned) cbm_open (15,8,15,0));
printf ("Chkin  returns: %d.\n", (unsigned) cbm_k_chkin (15));
//for (/*i=0*/;  (errch[i]=cbm_k_basin())!=13; ++i);
//errch[i]=0;
gets  (errch);
cbm_k_clrch();
cbm_k_close (15);
/* Display  error on screen. */
/* User: define display of error here.   Defaults to displaying
* in reverse-video on bottom of  screen.
* You need to reset the color after routine.  */
textcolor (10); revers(1);
cputsxy (0, 24,  errch);
revers (0);
cgetc();
 
 /* Return error #. */
i=atoi(errch);
return  i;
}
------------------------------------------------
The problem is that gets() seems to read from the keyboard, rather than  from 
the drive.  The printf()'s return 0 for cbm_open() and 2048 for  
cbm_k_chkin().  I don't understand what I'm doing  wrong.
**************One site keeps you connected to all your email: AOL Mail, 
Gmail, and Yahoo Mail. Try it now. 
(http://www.aol.com/?optin=new-dp&icid=aolcom40vanity&ncid=emlcntaolcom00000025)

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Dec 27 17:51:54 2008

This archive was generated by hypermail 2.1.8 : 2008-12-27 17:51:57 CET