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;
}

Recommended Answers

All 3 Replies

>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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.