473,385 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

output capture file format

hi all,
i have proramm which reads a *.cap file
i open this cap. file in binary format to read it,
now i want to write also an output file in this format output.cap.
i did that, i becam no errors and it works.
but when i tried to open this file
output.cap i becam an error as it's not a caputure file
my code is:( in this code i just try to read 4 variables and to write them in the outputfile)

Expand|Select|Wrap|Line Numbers
  1. string infile,outfile;
  2. char a,b,c,d;
  3.  
  4. void main ()
  5. {
  6.  
  7.  
  8.     cout<<"Enter your input filename"<<endl;
  9.         cin>>infile;
  10.         ifstream myinfile;
  11.  
  12. myinfile.open(infile.c_str(), ios::binary );
  13.  
  14.         cout<<"Enter your output filename"<<endl;
  15.         cin>>outfile;
  16.         ofstream myoutfile;
  17.         myoutfile.open(outfile.c_str(), ios :: binary);
  18.  
  19.  
  20.         myinfile>>a>>b>>c>>d;
  21.         myoutfile<<a<<b<<c<<d;         
  22. }
May 17 '07 #1
1 1636
AdrianH
1,251 Expert 1GB
Unless the .cap file is only 4 bytes long, then this won't work. You have to iterate over the entire file to make it work.

I would probably use read() and write() instead of reading in and writing out a byte at a time.

That or try using a copy/cp shell command. Its easier. ;)


Adrian
May 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dimitris | last post by:
I'm using ADO.NET to call a stored procedure that runs the "BACKUP" command on selected databases. Is there any way I can capture the text output of the stored proc and return it to ADO.NET for...
2
by: Salad | last post by:
It's been years since I captured printer output, basically I've forgotten how to do it. Can you refresh my brain and let me know how it's done if it can be done in Access? I don't want the...
1
by: Ernesto | last post by:
I'm looking for a way to capture command line output from a cmd session. Is there a way to use python to launch the application from the beggining.... then stream all of the output to a text...
1
by: untitled | last post by:
i wrote an application in c++ that capture a motion from a bmp sequence and outputs a 3DS max secript file contains the motions keys. i have two points here need to be fixed: 1- it is an offline...
12
by: vj | last post by:
I am using Borland C++. I run a program which generates output data files, say 'Voltage.dat', 'Current.dat'. I have a variable in my code (say N), and for various values of N (for each value of...
2
by: johnperl | last post by:
i am working on the script as below, i want an output according to the format. i am trying to put everything in one loop but cannot figure out the way to do so. could anyone please help me with this....
4
by: Tobiah | last post by:
I am not sure how to capture the output of a command using subprocess without creating a temp file. I was trying this: import StringIO import subprocess file = StringIO.StringIO() ...
5
by: amit.uttam | last post by:
Hey everyone, I've recently jumped big time into python and I'm working on a software program for testing automation. I had a question about proper logging of output. What I would like is: 1....
13
by: Jim Langston | last post by:
I had asked this in comp.lang.c++ with out any answers that would actually work, so I'm hoping someone here may know a way. I am calling C library functions that want to output to stdout. I need...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.