ascii?
oldnewbie (112)
Jan 13, 2012 at 6:41pm UTC
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?)
Cubbi (1927)
Jan 13, 2012 at 6:48pm UTC
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 Jan 13, 2012 at 6:49pm UTC
oldnewbie (112)
Jan 13, 2012 at 7:00pm UTC
(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?
Cubbi (1927)
Jan 13, 2012 at 7:01pm UTC
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.
Topic archived. No new replies allowed.