|
-
Aug 22nd, 2002, 08:45 AM
#1
Thread Starter
Fanatic Member
dll memory access error
Code:
int _stdcall writeppm(BSTR filename, BSTR filepath, int framerate){
int iCount;
long lItemNum;
BYTE *pnOutBuf=new BYTE;
WORD OutPicWidth, OutPicHeight;
FILE *pfFile=new FILE;
int start;
char *name=new char[255];
char *name1=new char[255];
for(int i=0;i<=1800;i++){
start = i * 60 + framerate;
//set the filename
if(start<10){
strcpy(name,"f000000");
} else if(start<1000){
strcpy(name,"f00000");
} else if(start<10000){
strcpy(name,"f0000");
} else if(start<100000){
strcpy(name,"f000");
} else if(start<1000000){
strcpy(name,"f00");
} else {
strcpy(name,"f0");
}
//set the name
char *buffer=new char[11];
strcpy(name1,(LPCSTR)filepath);
strcat(name1,(LPCSTR)filename);
strcat(name1,name);
strcat(name1,itoa(start,buffer,10));
strcat(name1,".ppm");
for (iCount=0;iCount<=1800;iCount++) {
if (deco.GetCurFrameNum(&lResult)!=MDC_SUCCESS)
return -2; //failed
if (deco.DecodePicture()<0)
return -3; //failed
lItemNum=deco.GetCurFrame(pnOutBuf,&OutPicWidth,&OutPicHeight,PPM);
if (lItemNum>0) {
MessageBox(NULL,"fopen","openfile",MB_OK); //debug
if((pfFile = fopen(name1,"w+")) == NULL)
return -4; //open file failed
it crashes on the fopen statement, first it says it cant write to the memory, then read. im calling the dll from VB, the calling etc works fine, and other functions work fine. it just crashes the vb ide and the program, with the error. ive narrowed it down to that line
ive tried different things for the file, like
FILE *pfFile = new FILE;
FILE *pfFile = NULL;
FILE *pfFile;
etc, any ideas?
oh yeah, i also did a MessageBox output for name1, that is fine.
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|