## fgets

The fgets reads a string from the file.

    char* fgets (
      char* Str,        /* Read buffer */
      int Size,         /* Size of the read buffer */
      FIL* FileObject   /* File object */
    );

#### Parameters

Str
  Pointer to read buffer to store the read string.
Size
  Size of the read buffer.
FileObject
  Pointer to the open file object structure.

#### Return Values

When the function succeeded, `Str` will be returuned.

#### Description

The fgets() is a wrapper function of f_read(). The read operation continues until a `'\n'` is stored, reached end of file or buffer is filled with Size - 1 characters. The read string is terminated with a `'\0'`. When the file is already reached end of file or any error occured during read operation, fgets() returns a `NULL`. The EOF status can be examined with `feof()` macro.

This function is available when `_USE_STRFUNC` is 1 or 2. When it is set to 2, `'\r'` contained in the file is stripped.

#### References

`f_open, f_read, fputc, fputs, fprintf, f_close, FIL`

Return