Click here to Skip to main content
15,921,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: what does CListCtrl::GetItemData() & 1 mean? Pin
fantasy12154-Nov-07 19:46
fantasy12154-Nov-07 19:46 
AnswerRe: what does CListCtrl::GetItemData() & 1 mean? Pin
Nishad S4-Nov-07 21:15
Nishad S4-Nov-07 21:15 
QuestionRe: what does CListCtrl::GetItemData() & 1 mean? Pin
fantasy12156-Nov-07 21:08
fantasy12156-Nov-07 21:08 
AnswerRe: what does CListCtrl::GetItemData() & 1 mean? Pin
Nishad S6-Nov-07 21:12
Nishad S6-Nov-07 21:12 
GeneralRe: what does CListCtrl::GetItemData() & 1 mean? Pin
fantasy12158-Nov-07 18:27
fantasy12158-Nov-07 18:27 
GeneralRe: what does CListCtrl::GetItemData() & 1 mean? Pin
Nishad S11-Nov-07 16:50
Nishad S11-Nov-07 16:50 
QuestionDynamic buffer allocation Pin
CodingLover4-Nov-07 18:40
CodingLover4-Nov-07 18:40 
AnswerRe: Dynamic buffer allocation Pin
Neo Andreson4-Nov-07 19:30
Neo Andreson4-Nov-07 19:30 
AnswerRe: Dynamic buffer allocation Pin
Paresh Chitte4-Nov-07 19:52
Paresh Chitte4-Nov-07 19:52 
GeneralRe: Dynamic buffer allocation Pin
CodingLover4-Nov-07 19:59
CodingLover4-Nov-07 19:59 
GeneralRe: Dynamic buffer allocation Pin
Paresh Chitte4-Nov-07 20:03
Paresh Chitte4-Nov-07 20:03 
GeneralRe: Dynamic buffer allocation Pin
CodingLover4-Nov-07 20:34
CodingLover4-Nov-07 20:34 
GeneralRe: Dynamic buffer allocation Pin
Paresh Chitte4-Nov-07 20:42
Paresh Chitte4-Nov-07 20:42 
GeneralRe: Dynamic buffer allocation Pin
chandu0044-Nov-07 21:10
chandu0044-Nov-07 21:10 
GeneralRe: Dynamic buffer allocation Pin
CodingLover4-Nov-07 21:34
CodingLover4-Nov-07 21:34 
AnswerRe: Dynamic buffer allocation Pin
Nelek4-Nov-07 22:07
protectorNelek4-Nov-07 22:07 
GeneralRe: Dynamic buffer allocation Pin
CodingLover4-Nov-07 22:12
CodingLover4-Nov-07 22:12 
GeneralRe: Dynamic buffer allocation Pin
vijay_aroli4-Nov-07 23:15
vijay_aroli4-Nov-07 23:15 
GeneralRe: Dynamic buffer allocation Pin
CodingLover4-Nov-07 23:31
CodingLover4-Nov-07 23:31 
GeneralRe: Dynamic buffer allocation Pin
Cedric Moonen4-Nov-07 23:44
Cedric Moonen4-Nov-07 23:44 
GeneralRe: Dynamic buffer allocation Pin
CodingLover5-Nov-07 0:02
CodingLover5-Nov-07 0:02 
GeneralRe: Dynamic buffer allocation Pin
David Crow5-Nov-07 3:38
David Crow5-Nov-07 3:38 
GeneralRe: Dynamic buffer allocation Pin
CodingLover5-Nov-07 17:13
CodingLover5-Nov-07 17:13 
GeneralRe: Dynamic buffer allocation Pin
Nelek4-Nov-07 23:43
protectorNelek4-Nov-07 23:43 
The intialization in void is correct, you can after cast to other types.

For the second question...

If you are changing the size for every iteration... you must do it at the last line of your loop.

void* pBuffer = NULL;

for (int i = 0; i < numFiles; i++)
{
	CFile f (a_szFileName[i], CFile::modeCreate | CFile::modeWrite);
	pBuffer = new BYTE [(a_differentSizes[i])];

	//Fill the buffer with the relevant data

	f.Write (pBuffer, (a_differentSizes[i] * sizeof (BYTE)));
	
	//Last Line
	delete [] pBuffer;
	pBuffer = NULL;
}


If you are using a simple iteration to go through the buffer, you should logically write the creation and the deletion at the beggining and at the end of your working area respectively, not into the loop.

void* pBuffer = NULL;
pBuffer = new BYTE [nBufferSize];

for (int i = 0; i < nBufferSize; i++)
{
	//do whatever you want with the individual BYTEs in the buffer

	if (*(pBuffer + i) == "F")
		//do something
}

delete [] pBuffer;
pBuffer = NULL;


was it what you wanted to know?


Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

Help me to understand what I'm saying, and I'll explain it better to you

Wink | ;)

GeneralRe: Dynamic buffer allocation Pin
CodingLover5-Nov-07 0:07
CodingLover5-Nov-07 0:07 

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.