0

hi all,
i have a caputure file ( *.cap) i open it in binary mode , now i nead 2 make an outfile , also *.cap
i gave the outfile 2 my prog. out.cap, it works and i became no errors, but when i tried 2 open it , it doesn't work.

i made nothing in the prog.
string infile,outfile;
char arr[10];
int i;
void main ()
{

cout<<"Enter your input filename"<<endl;
cin>>infile;
ifstream myinfile;
myinfile.open(infile.c_str(), ios::binary );
cout<<"Enter your output filename"<<endl;
cin>>outfile;
ofstream myoutfile(outfile.c_str());
for(i=0;i<10;i++)
{
myinfile>>arr;
myoutfile<<arr<<endl;
}

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by ghadahelal
0

>but when i tried 2 open it , it doesn't work.
You're reading from a binary oriented file stream but writing to a text oriented file stream. Most likely you want to open the output stream as binary also.

And please don't use chatty abbreviations. We have a rule against that because it makes posts less professional and more difficult to understand.

0

sorry for using the chatty words,
now shall i open may output file also in binary mode and write on it?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.