Advertisement
Guest User

Untitled

a guest
Nov 7th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. QString d;
  2. QFile f(QDir::currentPath() + "/input.txt");
  3. if( f.open( QIODevice::ReadOnly | QIODevice::Text ) )
  4. {
  5.     d = f.readAll();
  6.     f.close();
  7. }
  8. auto cutf8 = QTextCodec::codecForName("UTF-8");
  9. auto cw50 = QTextCodec::codecForName("windows-1250");
  10. auto cw51 = QTextCodec::codecForName("windows-1251");
  11.  
  12. QFile ff(QDir::currentPath() + "/output.txt");
  13.     if( ff.open( QIODevice::WriteOnly | QIODevice::Text ) )
  14.     {
  15.         QTextStream t(&ff);
  16.        
  17.         QTextStream* tt = new QTextStream(t.device());
  18.         tt->setCodec(cutf8);
  19.         *tt << d << "\r\n";
  20.         tt->flush();
  21.         delete tt;
  22.  
  23.         tt = new QTextStream(t.device());
  24.         tt->setCodec(cw50);
  25.         *tt << d << "\r\n";
  26.         tt->flush();
  27.         delete tt;
  28.  
  29.         tt = new QTextStream(t.device());
  30.         tt->setCodec(cw51);
  31.         *tt << d << "\r\n";
  32.         tt->flush();
  33.         delete tt;
  34.     }
  35.     ff.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement