F
faz
HI all,,
I used linux g++ 3.2.3 ...In my c++ code i am reading bit values from
a file as character..using the following:
char revStr[41],correctStr[41];
int count=0
ifstream in("config.txt",ios::in | ios::binary);
if(!in)
{
cout << "Cannot open read file.";
return 1;
}
while(in)
{ // in will be false when eof is reached
in.get(ch);
if(in)
{
cout << ch;
correctStr[count]=ch;
count++;
}
}
correctStr[count]='\0';
fn_revrs(correctStr,revStr,count);
cout<<"\nno of characters in file :"<<count<<endl;
cout<<"correct set of characters in file :\n"<<correctStr<<endl;
cout<<"rev of characters in file :\n"<<revStr<<endl;
Actually the number of characters in a file is 42....But it is taking
and giving the count value as 43,,,
Really i dont know why this is happening...
pls help me
regards,
fazal
I used linux g++ 3.2.3 ...In my c++ code i am reading bit values from
a file as character..using the following:
char revStr[41],correctStr[41];
int count=0
ifstream in("config.txt",ios::in | ios::binary);
if(!in)
{
cout << "Cannot open read file.";
return 1;
}
while(in)
{ // in will be false when eof is reached
in.get(ch);
if(in)
{
cout << ch;
correctStr[count]=ch;
count++;
}
}
correctStr[count]='\0';
fn_revrs(correctStr,revStr,count);
cout<<"\nno of characters in file :"<<count<<endl;
cout<<"correct set of characters in file :\n"<<correctStr<<endl;
cout<<"rev of characters in file :\n"<<revStr<<endl;
Actually the number of characters in a file is 42....But it is taking
and giving the count value as 43,,,
Really i dont know why this is happening...
pls help me
regards,
fazal