Seppo Mustonen : Programming Survo in C

Functions in library SURVO.LIB

output_open, output_line, output_close
Summary

int output_open(file)
char *file;      /* name of output file */

int output_line(string,file,editline)
char *string;    /* output string */
char *file;      /* name of output file */
int editline;    /* current output line in edit field */

int output_close(file)
char *file;      /* name of output file */
Description

The output_open function opens file to be used as an output file for SURVO 84C results.

The output_line function appends the given string to file, replacing string's terminating null character (EOS) with a newline character ('\n') in file.

Simultaneously string will be copied to editline in the current edit field, if 1<=editline<=r2. When editline overrides those limits, no error message is given, but copying is prohibited. Thus editline=0 supresses printing in the edit field.

The output_close function closes file.

Return Value

output_open returns 1 if the file was successfully opened and -1 otherwise. There is no return value for output_line and output_close.

See Also

edwrite

Application

The global SURVO 84C variable eout gives the name of the output file/ device the user has selected (by OUTPUT command, for example).

Normally eout is opened once by

int i;
i=output_open(eout);
if (i<0) return;

Then each output line is written by

int ed_output_line; /* initialized according to situation */
char line[LLENGTH]; /* filled with information to be written */
output_line(line,eout,ed_output_line++);

Finally, after all results have been written eout is closed by

output_close(eout);


Front page of Survo C libraries