From: Bill Chatfield Date: Sat, 29 Jul 2017 05:25:07 +0000 (-0400) Subject: Added documentation for setting the file type for fopen. X-Git-Tag: V2.17~109^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9d89613bb2d5f8817cd38886acdb92fa1f5395c5;p=cc65 Added documentation for setting the file type for fopen. --- diff --git a/doc/apple2.sgml b/doc/apple2.sgml index fe5c98767..4ed2af48c 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -511,11 +511,11 @@ url="ca65.html" name="assembler manual">.

-Specifying ProDOS File Types

+Specifying file types for fopen

- Problem Explanation + Explanation of File Types ProDOS associates a file type and an auxiliary type with each file. These type specifications are separate from the file's name, unlike @@ -531,18 +531,18 @@ url="ca65.html" name="assembler manual">. auxiliary type. Therefore, some additional mechanism for specifying the file types is needed. - Solution + Specifying the File Type and Auxiliary Type There are two global variables provided that allow the file type and auxiliary type to be specified before a call to + extern unsigned char _filetype; /* Default: PRODOS_T_BIN */ extern unsigned int _auxtype; /* Default: 0 */ - + The header file . + - #include - #include - #include - #include + #include <stdio.h> + #include <string.h> + #include <errno.h> + #include <apple2.h> + void main() { FILE *out; char *name = "MY.FAVS"; + /*-----------------------------*/ + _filetype = PRODOS_T_TXT; _auxtype = PRODOS_AUX_T_TXT_SEQ; + /*-----------------------------*/ + if ((out = fopen(name, "w")) != NULL) { fputs("Jorah Mormont\r", out); fputs("Brienne of Tarth\r", out); @@ -605,7 +610,7 @@ url="ca65.html" name="assembler manual">. } } - +

diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 5e4626fbc..672f5d6aa 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -517,6 +517,14 @@ url="ca65.html" name="assembler manual">.

+Specifying file types for fopen

+ +See section + +in the apple2 docoumentation. + + + License