Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. include <cstdio>
  2.  
  3. int puts(const char *s)
  4. {
  5.         FILE *pFile;
  6.         int result = 0;
  7.         static int callCount = 0;
  8.  
  9.         pFile = fopen("./puts.log", "w");
  10.         fprintf(pFile, "%d\n", ++callCount);
  11.  
  12.         while (*s)
  13.         {
  14.                 if (putchar(*s++) == EOF) return EOF;
  15.                 ++result;
  16.         }
  17.         if (putchar('\n') == EOF) return EOF;
  18.         fclose(pFile);
  19.         return ++result;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement