i m trying to read this input line what it does it grab first set of integer and convert into character then if this is space it goes to next line and then print the set of integer..so on as so fourth.
int main( int argc, char* argv[] )
{
if ( argc < 2 )
{
cerr << "Arguments missing" << endl;
cerr << "Usage: CharCounter infile" << endl;
return 1; // program failed
}
// set up input file
ifstream file; // declare an input file variable (object)
file.open( argv[0], ifstream::in ); // open an input file (binary)
if ( !file.good() )
{
// operation
cerr << "Cannot open input file " << argv[0] << endl;
return 2; // program failed (input)
}
int lNumberOfCharacters = 0;
int lCharacterCounts[256];
// init array
for ( int i = 0; i < 256; i++ )
lCharacterCounts[i] = 0;
while ( file.good() )
{
int lChar = file.get();
// some code
}
// this is a logic where is a is a input !!
int a;
cout << "what is your code?" << endl;
cin >> a;
cout << "You entered: " << a << endl;
do {
if (a == ' ') {
cout << endl;
}
int b = a % 256;
cout << char(b);
int c = a >> 8;
a = c;
} while (a != 0);
*/