1pack_fgets(3) Allegro manual pack_fgets(3)
2
3
4
6 pack_fgets - Reads a line from the stream. Allegro game programming
7 library.
8
10 #include <allegro.h>
11
12
13 char *pack_fgets(char *p, int max, PACKFILE *f);
14
16 Reads a line from the stream `f', storing it at location pointed to by
17 `p'. Stops when a linefeed is encountered, or `max' bytes have been
18 read. The end of line is handled by detecting the right combination of
19 characters for the platform. This supports CR-LF (DOS/Windows), LF
20 (Unix), and CR (Mac) formats. However, the trailing carriage return is
21 not included in the returned string, in order to provide easy code
22 portability across platforms. If you need the carriage return, use
23 pack_fread() and/or pack_getc() instead.
24
25 Note: This function internally may make calls to pack_ungetc, so you
26 cannot use pack_ungetc directly afterwards.
27
28 Example:
29
30 char buf[256];
31 ...
32 while (pack_fgets(buf, sizeof(buf), input_file)) {
33 /* Process input line. */
34 }
35 fclose(input_file);
36
38 Returns the pointer `p' on success, or NULL on error.
39
40
42 pack_fopen(3), pack_fopen_chunk(3), pack_fread(3), pack_getc(3),
43 pack_ungetc(3)
44
45
46
47Allegro version 4.2.2 pack_fgets(3)