Sample program CCNGAS1, shown in Figure 1, demonstrates how a program can write to an ASA file.
/* this example shows how to write to an ASA file */
#include <stdio.h>
#define MAX_LEN 80
int main(void) {
FILE *fp;
int i;
char s[MAX_LEN+1];
fp = fopen("asa.file", "w, recfm=fba");
if (fp != NULL) {
fputs("\n\nabcdef\f\r345\n\n", fp);
fputs("\n\n9034\n", fp);
fclose(fp);
return(0);
}
fp = fopen("asa.file", "r");
for (i = 0; i < 5; i++) {
fscanf(fp, "%s", s[0]);
printf("string = %s\n",s);
}
}
0abcdef
1
+345
-
9034