Results 1 to 17 of 17

Thread: Extracting text from files (AKA I'm a newbie!)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Extracting text from files (AKA I'm a newbie!)

    Complete beginner. Just starting with QT Creator and I wish to extract text from text files and do 'things' with it.

    So far I am easy with C++ and can get the text file into cout. I can also access the lines sequentially into a Qmessagebox on my form using

    Qt Code:
    1. void myQtApp::read()
    2. {
    3. char buffer [256];
    4. ifstream myfile ("C:test.txt");
    5. while (!myfile.eof())
    6. {
    7. myfile.getline (buffer,256);
    8. QMessageBox::about(this,"About myQtApp",buffer);
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 
    which I have 'cobbled' together from various on-line sources

    As a starter I wish to display the file contents in a textEdit box 'textEdit_2' on my form but cannot find a suitable form of words which will compile without some sort of error.

    I would be most grateful for some light in the dark, and any pointers to a comprehensive online 'beginner's guide' to QT.
    Last edited by jpn; 22nd January 2009 at 17:55. Reason: missing [code] tags

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Access violation when reading big text files
    By robertson1 in forum General Programming
    Replies: 0
    Last Post: 18th September 2008, 06:59
  3. problem with reading text files
    By Axsis in forum Newbie
    Replies: 1
    Last Post: 25th April 2008, 12:29
  4. Handling mac text format files - support?
    By bnilsson in forum Qt Programming
    Replies: 0
    Last Post: 29th March 2008, 12:10
  5. how to save sequences of text files and sound files
    By nagpalma in forum Qt Programming
    Replies: 8
    Last Post: 3rd July 2007, 00:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.