LabWindows/CVI

Content Type
Programming Language
Current manual

WriteLine

int WriteLine (int fileHandle, char lineBuffer[], ssize_t numberOfBytes);

Purpose

Writes numberOfBytes bytes from lineBuffer to a file and then writes a linefeed (LF) to the file.

Parameters

Input
Name Type Description
fileHandle int Specifies the file to which the line is to be written.

Call OpenFile to obtain a fileHandle. Open the file in ASCII mode so that WriteLine writes a carriage return (CR) before each LF. If fileHandle is 1, WriteLine writes the line to the Standard Output.
lineBuffer char [] Specifies the buffer from which the line is to be written.
numberOfBytes ssize_t Number of bytes to write from the buffer to the file.

If numberOfBytes is –1, WriteLine writes only the bytes in lineBuffer before the first ASCII NUL, followed by an LF.

The function returns an error if you pass a value greater than INT_MAX.

Note  This value does not include the LF.

Return Value

Name Type Description
bytesWritten int Number of bytes written to the file, excluding the LF.

A value of –1 indicates that an error occurred during the write operation, possibly because of a bad file handle or because the file was opened in read only mode. You can use GetFmtIOError to get more information about the type of error that occurred.

Additional Information

Library: Formatting and I/O Library

Include file: formatio.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Was this information helpful?

Log in to get a better experience

Help us improve your future ni.com experience.

Did you find the documentation you were looking for?

Submit