Results 1 to 4 of 4

Thread: ifstream failing, weird behavior

  1. #1
    Join Date
    Jun 2011
    Posts
    17
    Qt products
    Qt3
    Platforms
    MacOS X

    Default ifstream failing, weird behavior

    QString FPath = "C:/Documents and Settings/wrightc/Desktop/TESTS/PBP001TEST.txt";
    ifstream fin;
    fin.open(FPath.toStdString().c_str(),ios::in|ios:: binary);
    if (fin.fail())
    {


    }

    That is my code to open the file for reading with the code inside the if statement ommitted, basically just outputs an error message and returns. I am so confused as to why it wouldn't be working because I am using the exact same code in another function in this class and it opens the file with no problems.
    While debugging some weird linker messages are being outputted but I can't make anything of them

    can't find linker symbol for virtual table for `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep' value
    found `QPointer<QTextDocument>::~QPointer()' instead
    Last edited by BettaUseYoNikes; 24th August 2011 at 20:59.

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: ifstream failing, weird behavior

    I don't know why that is, but... as this is a Qt forum, you _obviously_ should use Qt classes for working the files... Now you just use a piece of generic C++ (with a C string converted from a Qt string as input).

  3. #3
    Join Date
    Jun 2011
    Posts
    17
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: ifstream failing, weird behavior

    I tried the exact same thing with the QFile Qt class and got the exact same result.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: ifstream failing, weird behavior

    The linker error message clearly has nothing at all to do with the code snippet you have shown us (it builds fine here). This is reinforced by your assertion that substituting the Qt classes for file access make no difference to the error output.

    The message contains references to QTextDocument and QPointer. Start by looking for the places in your code where you are using these classes/objects.

Similar Threads

  1. QWebview weird behavior on some pages
    By ZaQ in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2011, 03:24
  2. QWebView weird behavior !!
    By gontham in forum Newbie
    Replies: 1
    Last Post: 21st October 2010, 14:00
  3. Weird Deployment Behavior, Windows
    By skepticalgeek in forum Qt Programming
    Replies: 6
    Last Post: 6th October 2010, 08:51
  4. Weird removeRow behavior
    By metalinspired in forum Qt Programming
    Replies: 0
    Last Post: 30th August 2009, 12:42
  5. Weird QMenu behavior on Mac
    By munna in forum Qt Programming
    Replies: 1
    Last Post: 14th January 2009, 15:18

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.