user115610
user115610

Reputation:

fopen non-ascii character error

i cannot use fopen on files includes in their name some characters (example : ş, ç, ı) how can i use fopen on these files ? i'm using vc++ 6 (i have to) and c language. when i was trying to use _wfopen it's never open any file.

Upvotes: 2

Views: 1229

Answers (2)

plinth
plinth

Reputation: 49199

Make sure that you have wchar_t (it's a compiler setting) and make sure you're passing in a wchar_t * and not a char * to _wfopen.

Upvotes: 0

Ben Straub
Ben Straub

Reputation: 5776

Convert your pathname to UTF-16 (probably using MultiByteToWideChar) and use GetShortPathNameW to get a path you can pass to fopen.

Upvotes: 3

Related Questions