This also seems to work fine:
void readFile2(const char *filename)
{
char buf[200];
FILE *fp = fopen( filename, "r" );
if (fp)
{
fgets(buf, 100, fp);
fclose(fp);
printf("data: %s\n", buf);
}
}
void readFile2(const char *filename)
{
char buf[200];
FILE *fp = fopen( filename, "r" );
if (fp)
{
fgets(buf, 100, fp);
fclose(fp);
printf("data: %s\n", buf);
}
}
52 minutes ago, rje said:
This also seems to work fine:
cprintf("data: %s\r\n", buf);
2 hours ago, Greg King said:
You should use
printf();
in an example about stdio code.
On 8/11/2021 at 9:43 AM, rje said:
@Greg King, would it be wrong for me to add timestamp fields to cbm_readdir? I know most CBM devices don't read or write timestamp, but the directory entries have space for it, and it's used in the later drives, so....
29 minutes ago, rje said:
Updated.
It is messy, isn't it? CC65 pushes conio to us, and yet stdio is... well, stdio. The reality is that my code is always a work in progress.
7 minutes ago, rje said:
Not to mention (although you hinted at it) that avoiding printf can shrink the binary size.
/Users/rje/git/cc65/lib/cx16.lib(_printf.o):
CODE Offs=003D6C Size=0003A5 Align=00001 Fill=0000
BSS Offs=000359 Size=00002B Align=00001 Fill=0000
DATA Offs=0000FA Size=000003 Align=00001 Fill=0000
/Users/rje/git/cc65/lib/cx16.lib(cprintf.o):
CODE Offs=004299 Size=00002A Align=00001 Fill=0000
BSS Offs=000384 Size=000001 Align=00001 Fill=0000