Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++.moderated > #1988
| From | Alexander Bartolich <alexander.bartolich@gmx.at> |
|---|---|
| Newsgroups | comp.lang.c++.moderated, comp.lang.c++ |
| Subject | Re: Multiple files in one |
| Date | 2011-09-12 17:31 -0700 |
| Organization | albasani.net |
| Message-ID | <j4lor1$e4m$1@news.albasani.net> (permalink) |
| References | <a51089c8-6be0-4fa7-9237-39f686aa99a8@z18g2000yqb.googlegroups.com> |
Cross-posted to 2 groups.
fryme wrote:
> [...]
> For that purpose i'm using std::ios::binary. Here is some code,
> describes that process (it is sketch, not last variant):
You expect us to find bugs in a "sketch"?
> [...]
> std::fstream m_out(output_file_path, std::ios::out |
> std::ios::binary);
> std::ifstream input_image(m_image_file_path.toUtf8().data());
^^^^^^^^^^^^^^^
All right, you are using Qt.
> input_image.seekg(0, std::ios::end);
> image_length = input_image.tellg();
> input_image.seekg(0, std::ios::beg);
>
> // writing image length to output file
> m_out.write( (const char *)&image_length, sizeof(long long) );
>
> char *buffer = new char[image_length];
> input.read(buffer, image_length);
^^^^^
I guess you mean "input_image", not "input".
> [...]
> std::fstream m_in(m_file_path.toUtf8().data(), std::ios::in );
There is no "std::ios::binary" here. Is this just a detail missing
from the "sketch"?
> m_in.seekg(0, std::ios::beg);
> m_in.read((char *)&image_length, sizeof(long long));
> m_in.seekg(sizeof(long long));
As far as I know, the second argument of "seekg" has no default value.
> [...]
> std::fstream fs("E:\\Temp\\out.jpg");
Again no "std::ios::binary" here.
Please, create working example code.
--
host -t mx moderators.isc.org
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to comp.lang.c++.moderated | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Multiple files in one fryme <oleg.fry@gmail.com> - 2011-09-12 11:44 -0700 Re: Multiple files in one Alexander Bartolich <alexander.bartolich@gmx.at> - 2011-09-12 17:31 -0700 Re: Multiple files in one Paavo Helde <myfirstname@osa.pri.ee> - 2011-09-12 17:32 -0700 Re: Multiple files in one red floyd <no.spam.here@its.invalid> - 2011-09-12 17:32 -0700 Re: Multiple files in one Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-09-12 17:32 -0700 Re: Multiple files in one Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-12 17:34 -0700 Re: Multiple files in one Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-09-13 10:51 -0700 Re: Multiple files in one Daniel James <daniel@me.invalid> - 2011-09-13 10:53 -0700
csiph-web