## FGETLINE Read a String from a File

Section: Input/Ouput Functions

### Usage

Reads a string from a file. The general syntax for its use is

      s = fgetline(handle)

This function reads characters from the file `handle` into a `string` array `s` until it encounters the end of the file or a newline. The newline, if any, is retained in the output string. If the file is at its end, (i.e., that `feof` would return true on this handle), `fgetline` returns an empty string.

### Example

First we write a couple of strings to a test file.

    --> fp = fopen('testtext','w');
    --> fprintf(fp,'String 1
    ');
    --> fprintf(fp,'String 2
    ');
    --> fclose(fp);
    -->
    quit

Next, we read then back.

    --> fp = fopen('testtext','r')

    fp =

     12

    --> fgetline(fp)

    ans =

     String 1

    --> fgetline(fp)

    ans =

     String 2

    --> fclose(fp);
    -->
    quit