38 #include "blocxx/BLOCXX_config.h" 52 char *
fgets_trunc(
char * dst, std::size_t dstsize, FILE * fp)
54 char * res = std::fgets(dst, dstsize, fp);
66 char *
fgets_check(
char * dst, std::size_t dstsize, FILE * fp)
68 std::size_t
const end = dstsize - 1;
69 char savechar = dst[end];
71 char * res = std::fgets(dst, dstsize, fp);
72 char endchar = dst[end];
76 if (endchar ==
'\0' && (end == 0 || dst[end - 1] !=
'\n'))
83 std::ungetc(std::fgetc(fp), fp);
106 std::size_t
const BUFSIZE = 8 * 1024;
114 if (sb.
length() > max_chars)
char * fgets_trunc(char *dst, std::size_t dstsize, FILE *fp)
#define BLOCXX_THROW_ERR(exType, msg, err)
Throw an exception using FILE and LINE.
This String class is an abstract data type that represents as NULL terminated string of characters...
String fget_string(FILE *fp, std::size_t const max_chars)
bool endsWith(char ch) const
char * fgets_check(char *dst, std::size_t dstsize, FILE *fp)
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
int const RESULT_TRUNCATED
Error codes for use with OverflowException class.
StringBuffer & append(char c)