ACON
Home/Topics |
Commands |
More Examples
File Input/Output
/*----------------------------------------------------*/
/* this example shows reading a data file and writing */
/* it to an output file "x.out". */
/* In this example if the input record contains a */
/* comment line (like these), they are removed */
/*----------------------------------------------------*/
Function Remove_comments(fname)
{ eof = 255; /* ASCII end of file is 255 */
input = fopen(cat(fname,".in"),"r");
output = fopen(cat(fname,".out"),"w");
string = fgets(input);
while (chartonum(substr(string,1,1)) != eof) do
{ if (substr(string,1,2) != "/*") then fputs(string,output);
string = fgets(input);
};
fclose(input);
fclose(output);
};
Remove_comments(cat(HostPath(),"Test Data/Test_File_IO"));
ACON
Home/Topics |
Commands |
More Examples
|