![]() |
| ||
| kind of aggravating I am trying to dump 2 longs, an array of floats and DWORDs, and an array of shorts into a file, USING BINARY out mode. Here is my code: #include <windows.h> vertexs.h just has the declaration of the struct OURCUSTOMVERTEX. HERE is the crap that it is putting in my file (obviously not writing in binary out mode because this is just text). 594.29497e+0094.29497e+0094.29497e+009429496729504.29497e+0090000000000000000000123135345 I am looking for suggestions to solve my problem. maybe i missed something in my code... maybe it is all wrong.... maybe i am a retard.... or maybe this is a small issue that can easily be solved with another set of eyes.... thanks for the help |
| ||
| Re: kind of aggravating > .. obviously not writing in binary out mode because this is just text ios_base::binary only disables the control sequence translations ( for '\n', '\r' etc.) that take place during formatted input or output. to write raw binary data to a file, you will have to use unformatted output functions. eg. basic_ostream<>::write |
| ||
| Re: kind of aggravating Yes, don't feel bad. This trips up a lot of people. The << and >> are always for doing text output. If you know any C they are comparable to the printf() and scanf() functions. In other words, they always convert numbers to/from their string representations. So, like vijayan121 said, you'll have to go to a raw output function: f_DataFile.write( reinterpret_cast<const char *>( &i_verts ), sizeof( i_verts ) );Good luck. |
| All times are GMT -4. The time now is 9:53 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC