Advertisement
MDell95

batUpdate

Feb 20th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     ifstream bat;
  10.     char text[999999];
  11.     bat.open("AndroidProgrammierung.bat");
  12.     if(bat.is_open())
  13.         for(int i=0; !bat.eof(); i++){
  14.             text[i]=bat.get();
  15.         }
  16.     bat.close();
  17.  
  18.     char path[]="A:\\Informatik\\Dokumentation.htm";
  19.     char output[]="dir /-C A: >test.txt";
  20.     ifstream check;
  21.     for(int i=0; i<26; i++){
  22.         system(output);
  23.  
  24.         int filesize;
  25.         ifstream control;
  26.         control.open("test.txt");
  27.  
  28.         if(control.is_open())
  29.         {
  30.             int start=control.tellg();
  31.             control.seekg(0, ios::end);
  32.             int end=control.tellg();
  33.             filesize=end-start;
  34.             control.close();
  35.         }
  36.  
  37.         if(filesize>0)
  38.             check.open(path);
  39.         if(check.is_open()){
  40.             break;
  41.             check.close();
  42.         }
  43.         path[0]++;
  44.         output[8]++;
  45.     }
  46.  
  47.     for(int i=0; i<999999; i++){
  48.             if(text[i]==':' && text[i+1]=='\\')
  49.                 text[i-1]=path[0];
  50.         }
  51.  
  52.     ofstream txt;
  53.     txt.open("AndroidProgrammierung.bat", ios::trunc);
  54.     if(txt.is_open())
  55.     for(int i=0; text[i]!='ÿ'; i++)
  56.         txt << text[i];
  57.     txt.close();
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement