read data from a text file

Discussion in 'C++' started by gopesh patel, Feb 25, 2011.

  1. gopesh patel

    gopesh patel Guest

    Hello all,

    I have a text file and I want to read the data from it. I know I can
    do it by using getline or fread kind of functions.

    But the problem is data looks encoded in some unknown format and
    whenever I try to use getline or fread it doesn't show me anything.

    The data is in a text file called test.txt and it looks like
    following :

    A ÃŽ4?ÃÑ>¡Â¿­ôR>è¢ ¾Ò®û¾òôÂ>~<è¾uEð>uÕ¾Çû>ÂA>Âó´>…Âþ>ûˆ¾îJ
    ?

    Can someone help me with reading it ?

    Thanks,
    Gopesh
     
    gopesh patel, Feb 25, 2011
    #1
    1. Advertising

  2. gopesh patel

    James Kanze Guest

    On Feb 25, 10:09 pm, gopesh patel <> wrote:

    > I have a text file and I want to read the data from it. I know I can
    > do it by using getline or fread kind of functions.


    > But the problem is data looks encoded in some unknown format and
    > whenever I try to use getline or fread it doesn't show me anything.


    > The data is in a text file called test.txt and it looks like
    > following :


    > A ÃŽ 4?ÃÑ >¡ ¿­ôR>è¢ ¾Ò®û¾òô >~<è¾uEð> uÕ¾ Çû> A> ó´>… þ> ûˆ¾îJ
    > ?


    > Can someone help me with reading it ?


    It looks like some other encoding. (Since news, at least when
    read through Google, tends to mangle encodings somewhat, I won't
    venture a guess as to what it was originally.) Find out what
    encoding was used, imbue the appropriate locale, and you should
    be able to read it (although you might have to use wide
    characters).

    --
    James Kanze
     
    James Kanze, Feb 26, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krish
    Replies:
    1
    Views:
    1,082
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Oct 20, 2005
  2. Replies:
    2
    Views:
    633
    Thomas Matthews
    Feb 27, 2007
  3. Mmcolli00 Mom
    Replies:
    2
    Views:
    197
    Mmcolli00 Mom
    Jan 27, 2009
  4. Alex Dowad
    Replies:
    4
    Views:
    273
    Michel Demazure
    May 1, 2010
  5. Replies:
    19
    Views:
    245
    Andreas Perstinger
    Oct 7, 2013
Loading...

Share This Page