diff --git a/doc/apple2.sgml b/doc/apple2.sgml
index 3089a04c4..33a878223 100644
--- a/doc/apple2.sgml
+++ b/doc/apple2.sgml
@@ -511,6 +511,109 @@ url="ca65.html" name="assembler manual">.
+Specifying file types for fopen
+
+
+
+ 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
+ Windows which uses the file name's suffix (a.k.a.
+ extension) to specify the file type. For example, 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 Example
+
+ A text file cannot be created with just the
+ standard C functions because they default to the binary type
+
+
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
+ #include <apple2.h>
+
+ void main(void)
+ {
+ 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);
+ fputs("Daenerys Targaryen\r", out);
+ fputs("Sandor Clegane\r", out);
+ if (fclose(out) == EOF) {
+ fprintf(stderr, "fclose failed for %s: %s", name, strerror(errno));
+ }
+ }
+ else {
+ fprintf(stderr, "fopen failed for %s: %s", name, strerror(errno));
+ }
+ }
+
+
+
+
+
License
diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml
index 5e4626fbc..c7be9b474 100644
--- a/doc/apple2enh.sgml
+++ b/doc/apple2enh.sgml
@@ -517,6 +517,113 @@ url="ca65.html" name="assembler manual">.
+Specifying file types for fopen
+
+
+
+ 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
+ Windows which uses the file name's suffix (a.k.a.
+ extension) to specify the file type. For example, 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 Example
+
+ A text file cannot be created with just the
+ standard C functions because they default to the binary type
+
+
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
+ #include <apple2.h>
+
+ void main(void)
+ {
+ 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);
+ fputs("Daenerys Targaryen\r", out);
+ fputs("Sandor Clegane\r", out);
+ if (fclose(out) == EOF) {
+ fprintf(stderr, "fclose failed for %s: %s", name, strerror(errno));
+ }
+ }
+ else {
+ fprintf(stderr, "fopen failed for %s: %s", name, strerror(errno));
+ }
+ }
+
+
+
+
+
+
+
+
+
License