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

C / C++ / MFC

 
QuestionHow to save HBITMAP into *.png?? Pin
314159265316-Dec-06 18:05
314159265316-Dec-06 18:05 
AnswerRe: How to save HBITMAP into *.png?? Pin
Hadi Dayvary16-Dec-06 18:41
professionalHadi Dayvary16-Dec-06 18:41 
QuestionRom loaders. Pin
asp.netProgrammer16-Dec-06 17:26
asp.netProgrammer16-Dec-06 17:26 
AnswerRe: Rom loaders. Pin
Jeffrey Walton17-Dec-06 3:31
Jeffrey Walton17-Dec-06 3:31 
Questionregistry clearners Pin
locoone16-Dec-06 16:21
locoone16-Dec-06 16:21 
QuestionON_WM_MOUSEMOVE in CFrameWnd Pin
gokings16-Dec-06 16:08
gokings16-Dec-06 16:08 
AnswerRe: ON_WM_MOUSEMOVE in CFrameWnd Pin
includeh1016-Dec-06 20:17
includeh1016-Dec-06 20:17 
QuestionAuto Load Exployer with auto-loading of a specified file Pin
Larry Mills Sr16-Dec-06 8:02
Larry Mills Sr16-Dec-06 8:02 
AnswerRe: Auto Load Exployer with auto-loading of a specified file Pin
Luc Pattyn16-Dec-06 15:15
sitebuilderLuc Pattyn16-Dec-06 15:15 
GeneralRe: Auto Load Exployer with auto-loading of a specified file Pin
Larry Mills Sr17-Dec-06 13:27
Larry Mills Sr17-Dec-06 13:27 
GeneralRe: Auto Load Exployer with auto-loading of a specified file Pin
Mark Salsbery17-Dec-06 14:16
Mark Salsbery17-Dec-06 14:16 
GeneralRe: Auto Load Exployer with auto-loading of a specified file Pin
Larry Mills Sr20-Dec-06 14:11
Larry Mills Sr20-Dec-06 14:11 
GeneralRe: Auto Load Exployer with auto-loading of a specified file Pin
Mark Salsbery20-Dec-06 14:20
Mark Salsbery20-Dec-06 14:20 
GeneralRe: Auto Load Exployer with auto-loading of a specified file Pin
Larry Mills Sr21-Dec-06 23:21
Larry Mills Sr21-Dec-06 23:21 
GeneralRe: Auto Load Exployer with auto-loading of a specified file Pin
Mark Salsbery22-Dec-06 4:36
Mark Salsbery22-Dec-06 4:36 
QuestionVC6 is loosing my imports?! Pin
Neounk16-Dec-06 7:56
Neounk16-Dec-06 7:56 
Questionstructure problem (adaptive-sized char type variable in a structure) [modified] Pin
cy163@hotmail.com16-Dec-06 3:02
cy163@hotmail.com16-Dec-06 3:02 
In my program, I need a structure which looks like:
<br />
struct stru_A{<br />
char Name[MAX_LEN];<br />
float score;<br />
}<br />


Moreover, I declare a vector variable of type stru_A to hold Name_Score pairs. My problem arises with the member variable 'Name'.
<br />
vector 'struct stru_A' Name_Score_Collection;<br />
<br />

In the above declaration of stru_A, the size of Name, MAX_LEN, is predefined to be 30(#define MAX_LEN 30, to hold the longest name in my database). However, in the database many peoples' name are much less than 30 letters. Hence, much valuable memory space are wasted. I wonder what's the way to solve this problem.

I have tried with a string variable. It is true it can solve this problem. However, in the later part of my program I need to write each struture in vector Name_Score_Collection into a file on my hard disk. I used CFile::write() to accompolish this. CFile::write() worked fine with 'char Name[MAX_LEN]', but not with 'std::string Name'. I think this is because function write() need to know the exact size for each structure to be write out. The size of a string variable is not fixed.


-- modified at 9:29 Saturday 16th December, 2006
AnswerRe: structure problem (adaptive-sized char type variable in a structure) Pin
Rob Caldecott16-Dec-06 3:15
Rob Caldecott16-Dec-06 3:15 
GeneralRe: structure problem (adaptive-sized char type variable in a structure) Pin
Gary R. Wheeler16-Dec-06 3:22
Gary R. Wheeler16-Dec-06 3:22 
GeneralRe: structure problem (adaptive-sized char type variable in a structure) Pin
cy163@hotmail.com16-Dec-06 3:31
cy163@hotmail.com16-Dec-06 3:31 
GeneralRe: structure problem (adaptive-sized char type variable in a structure) Pin
Rob Caldecott16-Dec-06 3:46
Rob Caldecott16-Dec-06 3:46 
GeneralRe: structure problem (adaptive-sized char type variable in a structure) Pin
Jeffrey Walton17-Dec-06 10:15
Jeffrey Walton17-Dec-06 10:15 
GeneralRe: structure problem (adaptive-sized char type variable in a structure) Pin
Rob Caldecott17-Dec-06 11:01
Rob Caldecott17-Dec-06 11:01 
AnswerRe: structure problem (adaptive-sized char type variable in a structure) Pin
Gary R. Wheeler16-Dec-06 3:22
Gary R. Wheeler16-Dec-06 3:22 
GeneralRe: structure problem (adaptive-sized char type variable in a structure) Pin
cy163@hotmail.com16-Dec-06 3:31
cy163@hotmail.com16-Dec-06 3:31 

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.