Advertisement
Guest User

\n\r w/o ungetc

a guest
Dec 3rd, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. bool checknext = false;
  2. while ((ch = fgetc (infile)) != EOF) {
  3.     if (checknext && ch != '\r') {
  4.         fputc ('\r', outfile);
  5.     }  
  6.     fputc (ch, outfile);
  7.     checknext = ch == '\n';
  8. }
  9.  
  10. if (checknext) {
  11.     fputc ('\r', outfile);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement