[ create a new paste ] login | about

Link: http://codepad.org/So2S3hNv    [ raw code | output | fork ]

C++, pasted on Sep 1:
#include <iostream>
using namespace std;


int main(int argc, char* argv[])
{
	setlocale(LC_ALL,"RUS");
#ifdef UNICODE
	cout<<"UNICODE DEFINED\n";
#endif
	string line = "Привет мир! hi";
	cout<<line.size()<<endl;
	cout<<line.c_str()<<endl;
        cout<<sizeof(line[0])<<endl;
	cout<<sizeof(char)<<endl;
	cout<<sizeof(wchar_t)<<endl;
	cout<<sizeof(line)<<endl;
	cout<<"Raw bytes:"<<endl;
	for (unsigned i = 0; i < line.size();++i)
		cout<<"line["<<i<<"] : "<<hex<<int((unsigned char)line[i])<<"('"<<line[i]<<"')"<<endl;
	return 0;
}


Output:
23
Привет мир! hi
1
1
4
4
Raw bytes:
line[0] : d0('�')
line[1] : 9f('�')
line[2] : d1('�')
line[3] : 80('�')
line[4] : d0('�')
line[5] : b8('�')
line[6] : d0('�')
line[7] : b2('�')
line[8] : d0('�')
line[9] : b5('�')
line[a] : d1('�')
line[b] : 82('�')
line[c] : 20(' ')
line[d] : d0('�')
line[e] : bc('�')
line[f] : d0('�')
line[10] : b8('�')
line[11] : d1('�')
line[12] : 80('�')
line[13] : 21('!')
line[14] : 20(' ')
line[15] : 68('h')
line[16] : 69('i')


Create a new paste based on this one


Comments: