C
Clemens Park
Hi,
I am working on a compressor/decompressor for files,
and it works great at the moment with text files, but not great all with
binary files.
The problem is that it reads in binary files as text files, therefore
resulting in incorrect compression(it will compress 0.x% instead of around
97% for a certain file).
I am wondering if there is a certain function for cin that allows to
recognize an input file as binary. I am working in a UNIX environment, so
I pass in input files through standard input in the following format:
../a.out < testfile > testfile.cmp
where a.out is the executable file, testfile is the input file, and
testfile.cmp is the compressed file.
Hexdump was mentioned together with binary, but I don't get how it will be
used at all(and I know that I don't pipe the output of hexdump to a.out,
since I ran my program and the sample program provided(that works the
correct way) in the syntax mentioned above.
Any ideas?
I am working on a compressor/decompressor for files,
and it works great at the moment with text files, but not great all with
binary files.
The problem is that it reads in binary files as text files, therefore
resulting in incorrect compression(it will compress 0.x% instead of around
97% for a certain file).
I am wondering if there is a certain function for cin that allows to
recognize an input file as binary. I am working in a UNIX environment, so
I pass in input files through standard input in the following format:
../a.out < testfile > testfile.cmp
where a.out is the executable file, testfile is the input file, and
testfile.cmp is the compressed file.
Hexdump was mentioned together with binary, but I don't get how it will be
used at all(and I know that I don't pipe the output of hexdump to a.out,
since I ran my program and the sample program provided(that works the
correct way) in the syntax mentioned above.
Any ideas?