Function for skipping \r when writing text files.

This commit is contained in:
Moritz Bunkus 2003-06-21 15:45:55 +00:00
parent dfccb97236
commit ace4fd3281
2 changed files with 13 additions and 0 deletions

View File

@ -272,6 +272,18 @@ string mm_io_c::getline() {
#endif
size_t mm_io_c::writeline_unix_newlines(const char *s) {
int i;
size_t bytes_written;
bytes_written = 0;
for (i = 0; i < strlen(s); i++)
if (s[i] != '\r')
bytes_written += write(&s[i], 1);
return bytes_written;
}
/*
* Dummy class for output to /dev/null. Needed for two pass stuff.
*/

View File

@ -48,6 +48,7 @@ public:
virtual bool eof();
virtual char *gets(char *buffer, size_t max_size);
virtual string getline();
virtual size_t writeline_unix_newlines(const char *s);
};
class mm_null_io_c: public mm_io_c {