1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2010, 2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #ifndef LIBPSPP_U8_ISTREAM_H
18 #define LIBPSPP_U8_ISTREAM_H 1
20 #include <sys/types.h>
25 Reads a text file and reencodes its contents into UTF-8, with optional
26 automatic encoding detection.
29 #define U8_ISTREAM_BUFFER_SIZE 4096
31 struct u8_istream *u8_istream_for_fd (const char *fromcode, int fd);
32 struct u8_istream *u8_istream_for_file (const char *fromcode,
33 const char *filename, int flags);
35 int u8_istream_close (struct u8_istream *);
36 void u8_istream_free (struct u8_istream *);
38 ssize_t u8_istream_read (struct u8_istream *, char *, size_t);
40 int u8_istream_fileno (const struct u8_istream *);
42 bool u8_istream_is_auto (const struct u8_istream *);
43 bool u8_istream_is_utf8 (const struct u8_istream *);
45 #endif /* libpspp/u8-istream.h */