Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/input_line.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/input_line.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/input_line.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/input_line.html on line 8

input_line()

Get a string of characters from a file

Synopsis:

#include <stdio.h>

char* input_line( FILE* fp, 
                  char* buf, 
                  int bufsize );

extern int _input_line_max;

Arguments:

fp
The file that you want to read from.
buf
A pointer to a buffer where the function can store the string that it reads.
bufsize
The size of the buffer, in bytes.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.


Note: This function is in libc.a, but not in libc.so (in order to save space).

Description:

The input_line() function gets a string of characters from the file designated by fp and stores them in the array pointed to by buf. The input_line() function stops reading characters when:

In addition, the input_line() function buffers the last _input_line_max lines internally. The _input_line_max variable is defined in <stdio.h>. You can set it before calling input_line() for the first time; its default value is 20. While the line is being read, the KEY_UP and KEY_DOWN keys can be used to move to the previous and next line respectively in a circular buffer of previously read lines. The newline character (\n) is replaced with the null character on input.

Returns:

A pointer to the input line. On end-of-file or on encountering an error reading from fp, NULL is returned and errno is set.

Examples:

#include <stdlib.h>
#include <stdio.h>

#define SIZ 256

int _input_line_max;

int main( void )
  {
    FILE    *fp;
    char    *p,
         buf[SIZ];

    fp = stdin;               /* Or any stream */
    _input_line_max = 25;     /*  set before 1st call */

    while( ( p = input_line( fp, buf, SIZ ) ) != NULL ) {
      printf( "%s\n", buf );
      fflush( stdout );
    }
    return EXIT_SUCCESS;
  }

Classification:

QNX 4

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread No

Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/input_line.html on line 180

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/input_line.html on line 180