what is cout<< char(number);

Hi every one. I am new in C++. I have created a console proggram in Dev C++:
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
cout<< char (89);
cout<<"\n"<< char(28)<<"\n";
cout<<char(11);
system("PAUSE");
return EXIT_SUCCESS;
}
I'm wondering about the "char(number)"command? what can it do?
Please tell me.
Thanks so much!
It will output the value 28 as a character. A 28 (hex 1c) is known as a File Separator (FS) character.

It's equivalent to the following:
1
2
char fs(28);  // initialize fs with the value 28
cout << fs;   // output the value 28 as a char 

Last edited on
Thank you.
but what is File Seperator? Where can i read about it?
A FS character is simply an ASCII control character (a character with a value less than 32).

From wikipedia:
http://en.wikipedia.org/wiki/C0_and_C1_control_codes

Can be used as delimiters to mark fields of data structures. If used for hierarchical levels, US is the lowest level (dividing plain-text data items), while RS, GS, and FS are of increasing level to divide groups made up of items of the level beneath it.


thank you so much. :)
Topic archived. No new replies allowed.