On Sun, 1 Apr 2007 18:18:11 -0600, "nguser3552"
<nguser3552@comcast.netwrote in comp.lang.c++:
Quote:
Hello Everyone,
>
I have a problem I can't surmount, anything is gravy at this point.
I need to be able to read any type of file .ext (mov,mpeg,mp3,etc) in binary
format. I can do this in C, but have to use:
int main(int argc,char** argv)
which is archaic.
No it is not "archaic", it is perfectly valid C today and has been for
nearly 20 years. It is also exactly the way that all standard C
programs start today, if they want to use command line arguments.
So what is your problem with a C or C++ program that starts that way?
Quote:
My compiler is Visual Studio 5.0 Pro.
That is a very old version of Visual Studio, it
Quote:
To make my dilemma as clear as possible:
1. I need to accomplish the above (open any file format in binary)
You can use fopen("filename", "rb") in a C or C++ program. Or you can
use a C++ iostream with the binary flag. What is your particular
problem with opening a file in binary mode for reading?
Quote:
2. Place the data in an array.
Reading a binary file byte-by-byte and storing in an array is quite
simple. An array of unsigned char is the best choice for the
destination. What is your particular problem with reading bytes from
a binary file into an array?
Quote:
3. Produce one, all be it, large one line integer with no spaces (Bit
I have no idea what you mean by a "large one line integer with no
spaces". You will have to explain more. What kind of integer, one of
the standard types like int or unsigned long? How "large", and what
does "one line" mean?
Quote:
Manipulation I would guess) from the array - output #4 explains why.
Why do you think bit manipulation is necessary? If you start with a
binary file of, for example, 1000 bytes, and read it into an array of
1000 unsigned characters, you can consider it 1000 byte integer, if
you want to.
Quote:
4. Finally be able to perform mathematics on the "lengthy" integer using
(trig, calculus).
I don't understand this at all.
Quote:
Hoping not to anger anybody - the goal is to be able to get any type of file
to base2 without interval spaces and then have the ability to use an
equation on that particular files' base2 equivalent.
Yes, that's simple. Open the file in binary mode using either the C
FILE * functions or the C++ iostream functions. Read it byte-by-byte
into a large enough array of unsigned chars. I have no idea what you
mean by "interval spaces", but if you read a binary file byte-by-byte
into an array of unsigned chars, there won't be anything in the array
that wasn't in the file.
Quote:
Any and all help is naturally greatly appreciated, because my back is up
against the wall and I'm a bit out of my league with how to carry this out
in C++ effectively.
>
Thank you for your time.
I think you should post again and provide a better description of the
problem you are trying to solve. You seem to think that you need to
perform trigonometry on some non-angular value that you somehow
compute from the raw bytes of a binary file.
Explain the real requirement that you are trying to meet, and perhaps
people can suggest a reasonable method of accomplishing it. There
exist all sorts of existing code for computing a hash or checksum or
other relatively unique numeric value from the contents of a file, if
that's what you are trying to do.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html