Hello Guys,

I beginned programming with c++ a few month ago and since two weeks with qut... So im a newby :-)

I have written a source code with stl and i want to do the same thing with qt cause of the many options of qt library.

The Programm copy a file line for line... It would be better if its copy char for char, but i didn't find a good algorithm for that...

...So long I have two questions!

How can I programm this in QT (maybe somebody are so nice and write the code new ) that it read only char for char and not line for line . My other question is, is how i have to programm that, it makes a \n before the keyword i give him... I tryied in my code but without successs....

My english is also not good, so excuse me :-)

Qt Code:
  1. std::ifstream read(directory1);
  2. std::ofstream write( "Keyword.lst" );
  3.  
  4. std::string line;
  5.  
  6. while (std::getline( read, line ) && line!="*NET*");
  7.  
  8. write <<"*Automatic*"<<std::endl<<std::endl;
  9. write <<"*Test*"<<std::endl<<std::endl;
  10.  
  11. while ( !read.eof() )
  12. {
  13. std::getline(read, line);
  14. if(line == "*keyword*"){
  15. write <<' \n';
  16. write << line<<std::endl;
  17. }
  18. else
  19. write << line<<std::endl;
  20. }
  21.  
  22. write.close();
  23. read.close();
To copy to clipboard, switch view to plain text mode