Qt World Summit: Submit your Presentation

IOS/iPad fstream pointer error

  • @std::fstream* ptr_fsZoomfile = new std::fstream(ss.str(), std::fstream::in | std::fstream::binary);@

    This line works great on Linux, Mac, Windows and Android. On iOS (iPad) it crashes. File is all OK because if I create it as a none pointer it works OK.

    I need to create it as a pointer because it is going into a vector.

    Any thoughts?

  • What is ss? What does ss.str() return?

  • ss is a stringstream I use to build the filename.

    str returns const string.

    I have also checked that by putting a const string in, i.e. the full typed path.

  • Lifetime Qt Champion


    This question is not directly related to Qt, you should rather ask it on an iOS developer forum.

  • Yes, should have posted on an iOS site really.

    Anyway, for anybody searching:

    I managed to sort this today, by using a QSharedPointer, which xcode is much happier with:

    @QSharedPointer<fstream> ptr_fsZoomfileMultiple = QSharedPointer<fstream> (new fstream(ss.str(), std::fstream::in | ios::binary));@

Log in to reply