Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: abstract base class Pin
S. Senthil Kumar15-Oct-05 1:47
S. Senthil Kumar15-Oct-05 1:47 
GeneralRe: abstract base class Pin
toxcct15-Oct-05 1:55
toxcct15-Oct-05 1:55 
AnswerRe: abstract base class Pin
karmendra_js15-Oct-05 0:56
karmendra_js15-Oct-05 0:56 
QuestionCan any one help me to understand IOCP Pin
Member 168985514-Oct-05 23:49
Member 168985514-Oct-05 23:49 
Questionplea for assistance with CByteArray Pin
brian scott14-Oct-05 23:03
brian scott14-Oct-05 23:03 
AnswerRe: plea for assistance with CByteArray Pin
khan++14-Oct-05 23:21
khan++14-Oct-05 23:21 
GeneralRe: plea for assistance with CByteArray Pin
S. Senthil Kumar15-Oct-05 0:54
S. Senthil Kumar15-Oct-05 0:54 
AnswerRe: plea for assistance with CByteArray Pin
S. Senthil Kumar15-Oct-05 1:00
S. Senthil Kumar15-Oct-05 1:00 
You are violating one of the cardinal rules of C and C++ :- Never return a pointer to a local variable. In ReadData, you are calling GetData on a local variable and then returning a pointer to it. array will be destroyed as soon as the function ends, which means you'll be left with a pointer to nowhere.

This will solve that problem.

CByteArray MyClass::ReadData(CString Pathname,int filesize)
{
CByteArray array;
array.SetSize(filesize,-1);

FILE* ifile=fopen(Pathname,"rb");
array.SetSize(size);

BYTE *Array = array.GetData();
ZeroMemory(Array,size);

fread(Array,sizeof(BYTE),size,ifile);
return array; // return instance of CByteArray
}


Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
GeneralRe: plea for assistance with CByteArray - compiler errors Pin
brian scott15-Oct-05 1:43
brian scott15-Oct-05 1:43 
Questionhow to import 3D SMax file in VC++? Pin
Anonymous14-Oct-05 22:34
Anonymous14-Oct-05 22:34 
AnswerRe: how to import 3D SMax file in VC++? Pin
The NULL Developer14-Oct-05 22:49
professionalThe NULL Developer14-Oct-05 22:49 
GeneralRe: how to import 3D SMax file in VC++? Pin
Anonymous14-Oct-05 23:41
Anonymous14-Oct-05 23:41 
QuestionListBox Control problem with code Pin
Rahul U Kate14-Oct-05 22:05
Rahul U Kate14-Oct-05 22:05 
Question840723 - overriding an MFC function Pin
ilostmyid214-Oct-05 21:56
professionalilostmyid214-Oct-05 21:56 
AnswerRe: 840723 - overriding an MFC function Pin
khan++14-Oct-05 22:25
khan++14-Oct-05 22:25 
QuestionRe: 840723 - overriding an MFC function Pin
ilostmyid215-Oct-05 2:00
professionalilostmyid215-Oct-05 2:00 
Questionconvert cstring to int Pin
cell5114-Oct-05 21:01
cell5114-Oct-05 21:01 
AnswerRe: convert cstring to int Pin
Prakash Nadar14-Oct-05 21:09
Prakash Nadar14-Oct-05 21:09 
AnswerRe: convert cstring to int Pin
The NULL Developer14-Oct-05 21:17
professionalThe NULL Developer14-Oct-05 21:17 
AnswerRe: convert cstring to int Pin
John R. Shaw14-Oct-05 21:18
John R. Shaw14-Oct-05 21:18 
AnswerRe: convert cstring to int Pin
khan++14-Oct-05 21:19
khan++14-Oct-05 21:19 
QuestionFile Handle(very urgent) Pin
swaapu14-Oct-05 20:59
swaapu14-Oct-05 20:59 
AnswerRe: File Handle(very urgent) Pin
khan++14-Oct-05 21:17
khan++14-Oct-05 21:17 
GeneralRe: File Handle(very urgent) Pin
swaapu14-Oct-05 23:16
swaapu14-Oct-05 23:16 
GeneralRe: File Handle(very urgent) Pin
khan++14-Oct-05 23:38
khan++14-Oct-05 23:38 

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.