Example #1
0
	bool readLine(StreamSource& in, PodVector<char>::type& buf) {
		char buffer[1024];
		bool eol = false;
		uint32 i;
		buf.clear();
		for (i = 0; *in && (eol = in.matchEol()) == false; ++in) {
			buffer[i] = *in;
			if (++i == 1024) {
				buf.insert(buf.end(), buffer, buffer + i);
				i = 0;
			}
		}
		buf.insert(buf.end(), buffer, buffer + i);
		buf.push_back('\0');
		return eol;
	}
Example #2
0
bool readLine(StreamSource& in, PodVector<char>::type& buf ) {
	char   buffer[1024];
	uint32 i;
	buf.clear();
	for (i = 0;;) {
		buffer[i] = *in;
		++in;
		if (buffer[i] == '\n' || buffer[i] == '\0') {
			buf.insert(buf.end(), buffer, buffer+i+1);
			buf.back() = '\0';
			break;
		}
		if (++i == 1024) {
			buf.insert(buf.end(), buffer, buffer+i);
			i = 0;
		}
	}
	return buffer[i] == '\n';
}