Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

fgets (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: support

Requires: MathScript RT Module


a = fgets(fid)

a = fgets(fid, n)


Reads a specified number of characters or a line from a file. fgets(fid) reads a line from the file you specify in fid. fgets(fid, n) reads n characters from the file you specify in fid. If the file mark reaches an end-of-line character, LabVIEW stops reading from the file. To read a line or a specified number of characters from a byte stream file, you must use this function.



Name Description
fid Specifies the identifier for the file you want to read. Use the fopen function to open a file and assign it an identifier. fid is an integer.
n Specifies the number of characters to read from the file you specify in fid.


Name Description
a Returns the string LabVIEW reads from the file you specify in fid.


The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized


Make sure the file Test.m exists in the MathScript search path.

fid = fopen('Test.m');
s = fgets(fid, 12)

Related Topics



 Was this document helpful?  submit
  Helpful Not Helpful