Click here to Skip to main content
15,911,786 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ModalLess Dialog Pin
David Crow31-Mar-04 2:03
David Crow31-Mar-04 2:03 
Generalfile stream help pleaseeee Pin
strik29-Mar-04 16:37
strik29-Mar-04 16:37 
GeneralRe: file stream help pleaseeee Pin
Antti Keskinen29-Mar-04 18:50
Antti Keskinen29-Mar-04 18:50 
GeneralRe: file stream help pleaseeee Pin
strik29-Mar-04 20:26
strik29-Mar-04 20:26 
GeneralRe: file stream help pleaseeee Pin
Robert A. T. Káldy29-Mar-04 22:41
Robert A. T. Káldy29-Mar-04 22:41 
GeneralRe: file stream help pleaseeee Pin
Antti Keskinen30-Mar-04 0:04
Antti Keskinen30-Mar-04 0:04 
GeneralRe: file stream help pleaseeee Pin
Roger Allen30-Mar-04 0:44
Roger Allen30-Mar-04 0:44 
GeneralRe: file stream help pleaseeee Pin
Antti Keskinen30-Mar-04 2:38
Antti Keskinen30-Mar-04 2:38 
Basically, yes, though I might have presented it in an obscure manner.

An integer that is under the first 255 numbers from zero (0-255 or +128/-127) uses the last byte to designate it's value. All other bytes are zero. So, on writing this integer into a file, there will be three zero-bytes and one "data" byte.

Hence the saying "the integer is in limit of 1-byte dimension", meaning, that one byte is enough to represent the actual integer, though 4 bytes are always used, like you said.

Considering that an integer is "always" 4 bytes long in the memory (or in a file), it's representation in the file, whether it was one or more bytes long, should always show up correctly in memory as well, as memory-wise copying is done on byte-by-byte basis by the reading/writing functions. Or, this is how I have understood that they work..

This means that if the data becomes corrupted while doing this, there might be a compiler optimization command responsible that links the adjacent bytes to each other. Like, could it be that the 'size' optimization command decreases the memory requirement of an integer if it doesn't require all four bytes to represent itself ?
If the integer only requires two bytes to represent itself, the compiler, when executing with an optimization, actually caps the integer's length into two bytes ? I know this doesn't sound logical at all, but well, I'm quite outta ideas on why the data might get corrupted, as it does Smile | :)

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: file stream help pleaseeee Pin
Robert A. T. Káldy30-Mar-04 5:08
Robert A. T. Káldy30-Mar-04 5:08 
GeneralRe: file stream help pleaseeee Pin
Antti Keskinen30-Mar-04 8:35
Antti Keskinen30-Mar-04 8:35 
GeneralSome questions about inline function Pin
nachilau29-Mar-04 16:26
nachilau29-Mar-04 16:26 
GeneralRe: Some questions about inline function Pin
Ryan Binns29-Mar-04 16:50
Ryan Binns29-Mar-04 16:50 
GeneralRe: Some questions about inline function Pin
Maxwell Chen29-Mar-04 16:52
Maxwell Chen29-Mar-04 16:52 
GeneralRe: Some questions about inline function Pin
Christian Graus29-Mar-04 17:49
protectorChristian Graus29-Mar-04 17:49 
GeneralRe: Some questions about inline function Pin
includeh1029-Mar-04 18:18
includeh1029-Mar-04 18:18 
GeneralRe: Some questions about inline function Pin
jhwurmbach30-Mar-04 2:35
jhwurmbach30-Mar-04 2:35 
GeneralRe: Some questions about inline function Pin
includeh1030-Mar-04 6:06
includeh1030-Mar-04 6:06 
GeneralListView_GetItemText crashes Outlook Pin
jphillips_2003@hotmail.com29-Mar-04 15:07
jphillips_2003@hotmail.com29-Mar-04 15:07 
GeneralRe: ListView_GetItemText crashes Outlook Pin
Ryan Binns29-Mar-04 16:53
Ryan Binns29-Mar-04 16:53 
GeneralRe: ListView_GetItemText crashes Outlook Pin
jphillips_2003@hotmail.com29-Mar-04 17:30
jphillips_2003@hotmail.com29-Mar-04 17:30 
GeneralRe: ListView_GetItemText crashes Outlook Pin
jphillips_2003@hotmail.com29-Mar-04 19:24
jphillips_2003@hotmail.com29-Mar-04 19:24 
QuestionGlobal variable across multiple source files? Pin
LudaLuda29-Mar-04 14:23
LudaLuda29-Mar-04 14:23 
AnswerRe: Global variable across multiple source files? Pin
Rick York29-Mar-04 14:36
mveRick York29-Mar-04 14:36 
AnswerRe: Global variable across multiple source files? Pin
Christian Graus29-Mar-04 14:37
protectorChristian Graus29-Mar-04 14:37 
GeneralRe: Global variable across multiple source files? Pin
Robert A. T. Káldy29-Mar-04 22:46
Robert A. T. Káldy29-Mar-04 22:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.