Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User immicro's Avatar
    Join Date
    Mar 2011
    Posts
    13
    I successfully save text to external file with this code, but it works only on Nokia QT SDK emulator. On device I receive just empty video.ram file.

    Code:
        QString video; // video url string
        QTextCodec *codec = QTextCodec::codecForName("UTF-8");
        QByteArray data = codec->fromUnicode(video);
        
        const char* videoUrl = data.constData();
    
        QFile *file = new QFile("e://video.ram");
        if (file->open(QIODevice::WriteOnly)) {
        QTextStream out(file);
    
        out << videoUrl;
        file->close();
    Note:I set the permission writeUserData in .pro file

    Please advice!


    Thanks

  2. #2
    Super Contributor tamhanna's Avatar
    Join Date
    Jul 2008
    Posts
    2,020
    Does the device have a volume e, not f?

    Check in file manager.
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

  3. #3
    Registered User immicro's Avatar
    Join Date
    Mar 2011
    Posts
    13
    Yes mass storage is e volume, and what is strange when I put 'manualy' for example:

    out << "rtsp://v3.cache7.c.youtube.com/CjYLENy73wIaLQnHdoOcHgUFfBMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYLbi-pqEivrSTQw=/0/0/0/video.3gp";

    everything is ok.

    I'm puzzled by this.

    I use qt4.6 and E7 Nokia device.

  4. #4
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    1. make sure codec->fromUnicode(video); returning something by checking size of QByteArray data and
    2. try out << QString(data);

  5. #5
    Registered User immicro's Avatar
    Join Date
    Mar 2011
    Posts
    13
    Yes I checked just getting empty data array on device. How to solve this?

  6. #6
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968
    Quote Originally Posted by immicro View Post
    Yes I checked just getting empty data array on device. How to solve this?
    so the problem is not in writing on the device then QTextCodec *codec = QTextCodec::codecForName("UTF-8");


    i suggest you create another ticket for this.

  7. #7
    Nokia Developer Moderator gnuton's Avatar
    Join Date
    Mar 2009
    Posts
    1,024
    Hi immicro,
    According to your code QString video is empty... is that the cause which lead you to have an empty file?

    Moreover, I've seen you are playing with codecs instead of using QString methods.
    What about using something like this??

    out << QString::fromUtf8(charsArrayBuffer);

  8. #8
    Registered User immicro's Avatar
    Join Date
    Mar 2011
    Posts
    13
    Yes you are right, I found error elsewhere in the code, is not related to writing to device. Sorry...

Similar Threads

  1. Writing to files in the device
    By ratnadeep_joshi in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2010-02-16, 11:17
  2. Problems with writing 2 text files
    By nadym89 in forum Python
    Replies: 5
    Last Post: 2008-06-07, 13:27
  3. problem ith reading & writing text-files
    By szallah in forum Python
    Replies: 2
    Last Post: 2008-05-26, 00:33
  4. problem writing files
    By glamalil in forum Mobile Java General
    Replies: 13
    Last Post: 2007-06-04, 09:40
  5. Writing Files on Device from MIDP
    By terajiv in forum Mobile Java General
    Replies: 2
    Last Post: 2005-05-12, 13:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved