Given below code,from the console when enter a file name which contains Chinese characters,the program will crashed.What should I do?Thanks!!
Code: Select all
import "ecere"
class App:Application
{
public:
uint16* wstring(char* str)
{
uint16* result=UTF8toUTF16(str,null);
return result;
//delete result;
}
void byLine(const char* filename)
{
File file=FileOpen(filename,read);
while(!file.eof)
{
char line[1024];
if(file.GetLine(line,1024))
{
printf("%s\n",line);
}
}
}
void Main()
{
char input[1024];
printf("Please enter the file name:");//------->
scanf("%[^\n]",input);//------------------------->
byLine(input);//-->Crashed when encountered Chinese file name
system("pause");
}
}