Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #ifndef ANALISER
  2. #define ANALISER
  3.  
  4. #endif // ANALISER
  5. #include <windows.h>
  6. #include <string>
  7. using namespace std;
  8. class analyser {
  9. public:
  10.     //char* code = NULL;
  11.     //char *t;
  12.     string *s=NULL, *t;
  13.     analyser();
  14. };
  15.  
  16. analyser::analyser () {
  17.     char c;
  18.     int i = 1;
  19.     FILE * ptrFile2 = fopen("out.txt" , "r");
  20.     while ((c = fgetc(ptrFile2)) != EOF)
  21.         {
  22.                 t=s;
  23.                 s = (string*)realloc(t, i * sizeof(string));
  24.  
  25.         if (s == NULL)
  26.                 {
  27.                     printf("OutMemoryError!");
  28.                     exit(0);
  29.                 }
  30.         else
  31.                     if(t!=s)
  32.                         free(t);
  33.         *(s + i - 1) = c;
  34.         i++;
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement