Click here to Skip to main content
15,891,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: File read-plz help me? Pin
Hans Dietrich5-May-07 1:59
mentorHans Dietrich5-May-07 1:59 
AnswerRe: File read-plz help me? Pin
CPallini5-May-07 2:19
mveCPallini5-May-07 2:19 
AnswerRe: File read-plz help me? Pin
ThatsAlok16-May-07 19:38
ThatsAlok16-May-07 19:38 
QuestionFont of command buttons on property pages Pin
Neeraj Sinha5-May-07 1:19
Neeraj Sinha5-May-07 1:19 
AnswerRe: Font of command buttons on property pages Pin
prasad_som5-May-07 1:54
prasad_som5-May-07 1:54 
GeneralRe: Font of command buttons on property pages Pin
Neeraj Sinha5-May-07 2:03
Neeraj Sinha5-May-07 2:03 
GeneralRe: Font of command buttons on property pages Pin
prasad_som6-May-07 20:59
prasad_som6-May-07 20:59 
Questionhow to wisely use memory to store data Pin
cy163@hotmail.com5-May-07 1:18
cy163@hotmail.com5-May-07 1:18 
D'Oh! | :doh: I created a struct
[code]
struct S{

char Name[20];
int score;

}
[/code]
to store personal info of a lot of people. I need to store the data into hard disk file for later use. i use CFile.write(....) for this purpose.

My problem is that some memory space is wasted due to the design of the struct, since it is often that one' name is much less than 20 characters. In the above design, whenever a new structure is created by 'new', 24 bytes memory space is used.

I also designed another structure to solve this problem,
<br />
sturct S{<br />
string Name;<br />
int score;<br />
}<br />
<br />




However, this design had problem with the write() function of CFile. I found that actually nothing had written into the 'Name' item of a structure when I tried to read out the data from the file, but it is normal for the 'score' item of the same structure.


Anyone please tell how to solve this problem.

Thanks.
AnswerRe: how to wisely use memory to store data Pin
Hans Dietrich5-May-07 2:14
mentorHans Dietrich5-May-07 2:14 
AnswerRe: how to wisely use memory to store data Pin
Mark Salsbery5-May-07 6:48
Mark Salsbery5-May-07 6:48 
Questionstring copy problem in structure variable Pin
amitmistry_petlad 5-May-07 0:21
amitmistry_petlad 5-May-07 0:21 
AnswerRe: string copy problem in structure variable Pin
Hans Dietrich5-May-07 0:49
mentorHans Dietrich5-May-07 0:49 
GeneralRe: string copy problem in structure variable Pin
amitmistry_petlad 5-May-07 1:01
amitmistry_petlad 5-May-07 1:01 
AnswerRe: string copy problem in structure variable Pin
amistry_petlad12-Apr-10 12:49
amistry_petlad12-Apr-10 12:49 
QuestionHow To change degault font of ToolTip control? Pin
Atul234-May-07 23:38
Atul234-May-07 23:38 
Questionerror problem Pin
anu jaggi4-May-07 23:02
anu jaggi4-May-07 23:02 
AnswerRe: error problem Pin
amitmistry_petlad 4-May-07 23:58
amitmistry_petlad 4-May-07 23:58 
QuestionCreate Registry Entry in Vista ... Pin
Manjunath S4-May-07 22:33
Manjunath S4-May-07 22:33 
AnswerRe: Create Registry Entry in Vista ... Pin
prasad_som4-May-07 22:50
prasad_som4-May-07 22:50 
GeneralRe: Create Registry Entry in Vista ... Pin
Manjunath S4-May-07 22:56
Manjunath S4-May-07 22:56 
AnswerRe: Create Registry Entry in Vista ... Pin
Sameer_Thakur4-May-07 23:03
Sameer_Thakur4-May-07 23:03 
GeneralRe: Create Registry Entry in Vista ... Pin
Manjunath S4-May-07 23:21
Manjunath S4-May-07 23:21 
GeneralRe: Create Registry Entry in Vista ... Pin
Sameer_Thakur4-May-07 23:33
Sameer_Thakur4-May-07 23:33 
GeneralRe: Create Registry Entry in Vista ... Pin
Manjunath S4-May-07 23:45
Manjunath S4-May-07 23:45 
GeneralRe: Create Registry Entry in Vista ... Pin
Sameer_Thakur5-May-07 0:00
Sameer_Thakur5-May-07 0:00 

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.