ascii?

1
2
3
4
5
char greeting[]="Hello and welcome ";
char name[50];
cout<<question;
cin>>name;
cout<<endl<<greeting<<name;


I use this and it works for non-ascii characters.How can it be possible?(unicode?)
C++ (and C) I/O works with multibyte character strings, on platforms where that is supported.
This is normal :)

(as a side note, never do cin >> name where name is an array. Either make name a string, or use cin >> setw(50) >> name)
Last edited on
(as a side note, never do cin >> name where name is an array. Either make name a string, or use cin >> setw(50) >> name)


You say that for purpose of displaying or is there any other problem with it?
I say that for the purpose of preventing buffer overflow exploits. As written, this program allows any malicious user execute any code by pasting it into the program's input.
Thanks for the reply Cubbi.
Topic archived. No new replies allowed.