Programming Guide



sm_fio_puts

Writes a line of text to an open file

int sm_fio_puts(char *string, int file_stream);
string
Character string to be output.

file_stream
A handle to the file to write to, obtained by sm_fio_open.

Returns

Description

sm_fio_puts writes the contents of string to the specified open file and appends a newline \n character. Be sure to call sm_fio_close on file_stream after you finish writing the data; the actual write operation is not complete until the handle to this file stream is released.

Example

proc putStr()
{
vars str, occurNo, err, fileStream, maxOccurs
call sm_fio_error_set(0)

/* get array size */
maxOccurs = @widget("comments")->max_occurrences

/*get file stream handle sent from previous dialog */
receive BUNDLE f_handle DATA fileStream

/* loop through array occurrences */
for occurNo = 1 && err = 0 \
while (err == 0 && occurNo <= maxOccurs)
{
/* get string in current occurrence */
str = comments[occurNo]

/* put string into next line of file stream */
err = sm_fio_puts(str, fileStream)
}

/* close file stream when done */
call sm_fio_close(fileStream)
return
}