Home arrow C and C++ Tips
C and C++ Tips
Print UNICODE Chars in C/C++ PDF
Saturday, 12 November 2011
For that purpose we will use '/u' character. UNICODE-8 is on 2 bytes, 4 digits. See next example:

unicode_example_in_c.cc
#include <iostream>

using namespace std;

int main(void)
{
  char const *greek = "\u03A9\u03A8\u03EA";
  printf("char: %s\n", greek);
}


Last Updated ( Saturday, 12 November 2011 )
 
Convert an Integer to String in C++ PDF
Tuesday, 17 May 2011
We can use a stringstream variable for that. See next example:

example1
#include <iostream>
#include <sstream>

using namespace std;

int main(void)
{
  stringstream sstream;
  int var=100;

  sstream << var;
  cout << sstream.str() << endl;
}


If we later asign other value to sstream variable, we must first clear it. See next example:


example2
#include <iostream>
#include <sstream>

using namespace std;

int main(void)
{
  stringstream sstream;
  int var=100, var2=200, var3=300;

  sstream << var;
  cout << sstream.str() << endl;

  sstream << var2;
  cout << sstream.str() << endl;

  sstream.str(""); // this will clear sstream var
  sstream << var3;
  cout << sstream.str() << endl;
}


 

Other BSD Systems

OpenBSD

Polls

Best BSD firewall?