Answered How to write wchar_t type variable into a file?

  • Friday, May 11, 2012 6:11 AM
     
     

    Hi all,

    I'm getting error while writing wchar_t type variable.I'm doing it like following:

    <var>wchar_t</var> name[255] = {0};

    FILE * pFile;
    pFile = fopen (<kbd>"myfile.txt"</kbd>,<kbd>"w"</kbd>);

    fwrite(name, <var>sizeof</var>(<var>wchar_t</var>), wclen(name), pFile);
    fclose(pFile);

    Can any one plese tell me where is the problem?

    How should i write into file??

    Note: I can not chage the name type.

    Thnaks.


    Jyotiranjan

All Replies

  • Friday, May 11, 2012 6:18 AM
    Moderator
     
     

    "I'm getting error while"

    Well, what error?

  • Friday, May 11, 2012 6:22 AM
     
     Answered
    Now it's working... I used : "fputws" http://en.wikibooks.org/wiki/C_Programming/C_Reference/wchar.h :)

    Jyotiranjan

    • Marked As Answer by RoutJ Friday, May 11, 2012 6:22 AM
    •