Results 1 to 8 of 8

Thread: Read Text file using structure..

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Read Text file using structure..

    then how to do use structure?


    and how to read continuous 5 characters[including space] in a text file..

    Qt Code:
    1. QTextStream data(&fileA);
    2. char *runno=new char[5];
    3. data>>runno;
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Read Text file using structure..

    You can always do it like this:
    Qt Code:
    1. QFile file(...);
    2. file.open(QFile::ReadOnly);
    3. QByteArray data = file.read(5);
    4. strcpy(structure.no, data.constData());
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. read file from end to beginning..
    By soul_rebel in forum Qt Programming
    Replies: 11
    Last Post: 4th June 2012, 01:20
  2. Replies: 8
    Last Post: 8th May 2012, 09:39
  3. Replies: 5
    Last Post: 27th May 2009, 12:49
  4. How to read line from file
    By Krishnacins in forum Newbie
    Replies: 10
    Last Post: 1st June 2006, 23:14
  5. Replies: 13
    Last Post: 1st June 2006, 14:01

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.