Results 1 to 7 of 7

Thread: can't read from unicode file .

  1. #1
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default can't read from unicode file .

    hi everyone !

    I searched a lot in net but I couldnt fine any solution for my issue .

    i want to read some data from a file

    Qt Code:
    1. ifstream in ("input.txt");
    To copy to clipboard, switch view to plain text mode 

    when encoding of input.txt is ANSI i don't have any problem , but when i change the encoding to Unicode or UTF-8 the complier give me a warning :
    Qt Code:
    1. Invalid parameter passed to C runtime function.
    To copy to clipboard, switch view to plain text mode 

    and the program doesn't run and say :


    I have windows 7 home premium .

    I dont have this problem in Ubunutu9.10

    I need your help !!

    thank every one.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can't read from unicode file .

    Show your code

  3. #3
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: can't read from unicode file .

    i don't think source code cause the error .
    i think the problem is just because of encoding of input.txt that i want to read from that.
    because when the input.txt encoding is ANSI , program runs without any error
    but when i change the encoding to Unicode , program doesn't run .

    ----

    which part of the code ?

    code directory : http://saeed.pdprobocup.com/gstats
    download link : http://saeed.pdprobocup.com/gstats.zip

  4. #4
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: can't read from unicode file .

    hey no idea !!!

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: can't read from unicode file .

    Quote Originally Posted by gbmtoday View Post
    hey no idea !!!
    Hey, no source code??? And maybe you should use QFile if you work with Qt and not the "old" c/c++ functions to access a file.

  6. #6
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: can't read from unicode file .

    Quote Originally Posted by Lykurg View Post
    Hey, no source code??? And maybe you should use QFile if you work with Qt and not the "old" c/c++ functions to access a file.
    hey thanks , i used QFile and now I can read from a unicode file , but

    i want to read ARABIC or PERSIAN from the input file but it doesnt work correctly ...

    any idea ?


  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: can't read from unicode file .

    any idea ?
    Yes, but if we would see how you use QFile (filename and linenumber on your server) our answers could be a bit more precise. If you what specific control while reading from a file use QTextStream where you have more options. (QTextStream::setCodec() and/or QTextStream::setLocale())

  8. The following user says thank you to Lykurg for this useful post:

    gbmtoday (22nd February 2010)

Similar Threads

  1. Character by Character (Unicode?) File Reading
    By mclark in forum Qt Programming
    Replies: 4
    Last Post: 22nd April 2009, 15:28
  2. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 15:42
  3. Replies: 1
    Last Post: 20th June 2008, 18:43
  4. Read An Xml File
    By Alienxs in forum Qt Programming
    Replies: 3
    Last Post: 5th January 2007, 00:28
  5. Reading a unicode names from a file???
    By darpan in forum Qt Programming
    Replies: 7
    Last Post: 3rd May 2006, 17:28

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.