| Цитата(миг @ 15.3.2011, 05:30) | Цитата(neokoder3 @ 14.3.2011, 08:07 ) | Блин, была бы возможность удалиил бы свой код. Вот пишешь, людям помогаешь, а благодарности в ответ никакой
| Код | TCHAR mes[]=_T("File was create. Файл успешно создан.\x0\x0"); char mes_866[100]; int buf_size=WideCharToMultiByte(866,0,mes,lstrlen(mes),mes_866,0,"-",NULL); WideCharToMultiByte(866,0,mes,lstrlen(mes),mes_866,buf_size,"-",NULL); printf("%s\n",mes_866);
|
|
мне кажется, что ваш код будет не совсем корректно работать. А именно при выводе строки на экран функцией printf. на экране появится не только эта строка "File was create. Файл успешно создан.", но еще и весь мусор, который храниться в массиве mes_866[100]. Так, что рекомендую добавить строчку mes_866[buf_size]='\0'; |
| Цитата | Size, in characters, of the string indicated by lpWideCharStr. Alternatively, this parameter can be set set to -1 if the string is null-terminated. If cchWideChar is set to 0, the function fails.
If this parameter is -1, the function processes the entire input string, including the terminating null character. Therefore, the resulting character string has a terminating null character, and the length returned by the function includes this character.
If this parameter is set to a positive integer, the function processes exactly the specified number of characters. If the provided size does not include a terminating null character, the resulting character string is not null-terminated, and the returned length does not include this character.
|
ага, но можно убрать указание размера и все ок будет
|