Re: [cc65] Problems with file I/O (second try)

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2001-08-24 11:56:18


On Thu, Aug 23, 2001 at 09:09:06PM +0200, udo klasmeier wrote:
> i still have problems with file-io, although i think i followed the rules.
> here is a a small piece of code.

What is wrong with this code? It is quite difficult to help, if you don't tell

    ... what you expect your code to do,

    ... what the code does instead,

    ... and why you think this behaviour is not correct.

I'm no CBM file i/o guru, but maybe you have to read the error message from
the drive if the scratch is not successful? But the code seems to work ok for
me using VICE and this program:

	#include <stdio.h>
	#include <stdlib.h>
	#include <conio.h>
	#include <cbm.h>

	int OpenOutput (const char* fn, int fnr)
	{
	    char cmd[64];
	    int rc;
	    sprintf (cmd, "s:%s", fn);
	    rc = cbm_open(15, 8, 15, cmd);
	    cprintf ("Scratch: %d\r\n", rc);
	    cbm_close (15);
	    sprintf (cmd, "%s,s,w", fn);
	    rc = cbm_open (fnr, 8, fnr, cmd);
	    cprintf ("Open: %d\r\n", rc);
	}

	int main (void)
	{
	    OpenOutput ("fasel", 2);
	    return EXIT_SUCCESS;
	}

Regards


        Uz


--
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:41 CET