fwrite problem

Iam trying to write a TCHAR array value to a file.But i am not getting it correctly.I should get the data continously.But iam getting Null between each character.
1
2
3
4
5
FILE * pFile;
  TCHAR buffer[] = {"INPUT"};
   fopen_s (&pFile,_T("myfile.#abc"), "w+");
  fwrite (buffer , wcslen(buffer)+1, sizeof(TCHAR),pFile);
  fclose (pFile);

Output i should get
INPUT

Output iam getting

I[NULL]N[NULL]P[NULL]U[NULL]T[NULL]
1. The code you posted does not compile when _UNICODE is defined. Nor when it isn't, for that matter. So how can you have run it?

2. What do you mean by output?

You do know that, in bytes, little-endian Unicode text for regular chars is like 'I', '\0', 'N', '\0', 'P', '\0', 'U', '\0', 'T', '\0' (where the bytes are shown by their chars.)

So how are you looking at your output?

Andy
Topic archived. No new replies allowed.