Advertisement
Guest User

Untitled

a guest
Jul 15th, 2016
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.39 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <fstream>
  4. #include <string>
  5. #include <cstdio>
  6. using namespace std;
  7.  
  8. int main(int argc, char* argv[])
  9. {
  10.     setlocale(LC_ALL, "rus");
  11.     char input[128] = "";
  12.     char stop[] = "stop";
  13.     char str[256];
  14.     int l = 0;
  15.     string file;
  16.     char buff2[] = "\"){chat.close();}}}});";
  17.     ifstream fin("script.txt"); //объявление строк и файлов
  18.     fstream fout("script.txt");
  19.  
  20.     if (!fin.is_open()) // проверка
  21.     {
  22.         cout << "Файл не может быть открыт!\n";
  23.     }
  24.     getline(fin, file);
  25.    
  26.     if (l == 0)
  27.     {
  28.         for (int h = 1; h < 23; h++)
  29.         {
  30.             file[file.size() - h] = '\0';
  31.         }
  32.         fout << file;
  33.     }
  34. b:  cout << "Введите слово, которое будет пропускаться : ";
  35.     cin.getline(input, 128);
  36.    
  37.     FILE * ptrFile = fopen("script.txt", "a+");
  38.    
  39.     int a = strcmp(stop, input);
  40.     if ( a==0 ) //остановка программы
  41.     {
  42.         if (l > 0)
  43.         {
  44.             fputs(buff2, ptrFile);
  45.         }
  46.         return 0;
  47.     }
  48.  
  49.     fseek(ptrFile, 22, SEEK_END);
  50.     char buff[] = " || content == \"";                   // " || content == \"" + input + "\"){chat.close();}}}});";
  51.     l = l+1;
  52.     sprintf(str, "%s %s %s", buff, input, "\""); //Двач,в этом месте нужно,чтобы input был в "" ,но без пробелов (сейчас " input ")
  53.     fputs(str, ptrFile);
  54.     goto b;
  55.     return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement