Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

1. I want to download a xml file from a server and save it as a xml file using Iweb and http protocol. I found some examples downloading bmp and sound files, which is different from regular file. Does anybody have an example for downloading a regular file, such as xml file?

2. I use HTTP GET to get the file from the server, is this right?
IWEB_GetResponse(pApp->m_pIWeb,
(pApp->m_pIWeb, &pApp->m_pIWebResp, &pApp->m_Callback,
url, WEBOPT_HANDLERDATA, pApp, WEBOPT_STATUSHANDLER, NULL,
WEBOPT_END));

3. Also, after I download the xml file from the server and save to the local drive, where is this AEE_SHARED_DIR on the PC?

Thank you.

Anybody knows about this? Thank you.

Anybody knows about this? Thank you.

Hi
as u want to save the file in the local file system ,
u just need to write
ByteCount = ISOURCE_Read(pISource, (char*)buf, sizeof(buf));
"Buf" in the file in the append mode and for more help goto the following link
http://brewforums.qualcomm.com/showthread.php?threadid=4119

Hi
as u want to save the file in the local file system ,
u just need to write
ByteCount = ISOURCE_Read(pISource, (char*)buf, sizeof(buf));
"Buf" in the file in the append mode and for more help goto the following link
http://brewforums.qualcomm.com/showthread.php?threadid=4119

Quote:Originally posted by Dhaval
Hi
as u want to save the file in the local file system ,
u just need to write
ByteCount = ISOURCE_Read(pISource, (char*)buf, sizeof(buf));
"Buf" in the file in the append mode and for more help goto the following link
http://brewforums.qualcomm.com/showthread.php?threadid=4119
So, I don't need to use IMemAStream interface? ISource and IFile are enough?
Now, I can access my server, but downloading xml file causes error, IFILE_Write():
default:
if (ByteCount)
{
IFILE_Write(pIFile, buf, ByteCount);****

THe error says: "unhandled exception in BREW_Emulator.exe: 0x0000005: Access Violation". What does this mean?
I think the problem is where do I write the file to, AEE_SHARED_DIR. Where is that on the PC? Is it default C:/? How do I define it?
Thank you.

Quote:Originally posted by Dhaval
Hi
as u want to save the file in the local file system ,
u just need to write
ByteCount = ISOURCE_Read(pISource, (char*)buf, sizeof(buf));
"Buf" in the file in the append mode and for more help goto the following link
http://brewforums.qualcomm.com/showthread.php?threadid=4119
So, I don't need to use IMemAStream interface? ISource and IFile are enough?
Now, I can access my server, but downloading xml file causes error, IFILE_Write():
default:
if (ByteCount)
{
IFILE_Write(pIFile, buf, ByteCount);****

THe error says: "unhandled exception in BREW_Emulator.exe: 0x0000005: Access Violation". What does this mean?
I think the problem is where do I write the file to, AEE_SHARED_DIR. Where is that on the PC? Is it default C:/? How do I define it?
Thank you.

Look at the following FAQ on the shared directory. https://brewx.qualcomm.com/bws/content/gi/common/appseng/en/developerfaq...

Look at the following FAQ on the shared directory. https://brewx.qualcomm.com/bws/content/gi/common/appseng/en/developerfaq...

mzichao,
Let me explain you how shared dir is managed.
You have brew application say HelloWorld, in directory say C:\myapp
There are 3 components.
1. MIF -> in our case it will be HelloWorld.mif which will be placed in c:\myapp, so path will be c:\myapp\HelloWorld.mif
2. DLL/MOD -> in our case it will be in directory HelloWorld, the path will be
c:\myapp\HelloWorld\HelloWorld.mif
Now you need to create "Shared" directory in c:\myapp so path will be C:\myapp\Shared. This directory is referred by AEE_SHARED_DIR.
MOST IMPORTANT THING HERE IS.. IF YOU ARE TRYING TO ACCESS SHARED DIR, CHECK THE PERMISSIONS IN MIF FILE. IF YOU WANT TO ACCESS IT, YOU NEED TO CHECK SHARED DIR PERMISSION IN MIF FILE OF APPLICATION.

mzichao,
Let me explain you how shared dir is managed.
You have brew application say HelloWorld, in directory say C:\myapp
There are 3 components.
1. MIF -> in our case it will be HelloWorld.mif which will be placed in c:\myapp, so path will be c:\myapp\HelloWorld.mif
2. DLL/MOD -> in our case it will be in directory HelloWorld, the path will be
c:\myapp\HelloWorld\HelloWorld.mif
Now you need to create "Shared" directory in c:\myapp so path will be C:\myapp\Shared. This directory is referred by AEE_SHARED_DIR.
MOST IMPORTANT THING HERE IS.. IF YOU ARE TRYING TO ACCESS SHARED DIR, CHECK THE PERMISSIONS IN MIF FILE. IF YOU WANT TO ACCESS IT, YOU NEED TO CHECK SHARED DIR PERMISSION IN MIF FILE OF APPLICATION.

Quote:Originally posted by navaltiger
mzichao,
Let me explain you how shared dir is managed.
You have brew application say HelloWorld, in directory say C:\myapp
There are 3 components.
1. MIF -> in our case it will be HelloWorld.mif which will be placed in c:\myapp, so path will be c:\myapp\HelloWorld.mif
2. DLL/MOD -> in our case it will be in directory HelloWorld, the path will be
c:\myapp\HelloWorld\HelloWorld.mif
Now you need to create "Shared" directory in c:\myapp so path will be C:\myapp\Shared. This directory is referred by AEE_SHARED_DIR.
MOST IMPORTANT THING HERE IS.. IF YOU ARE TRYING TO ACCESS SHARED DIR, CHECK THE PERMISSIONS IN MIF FILE. IF YOU WANT TO ACCESS IT, YOU NEED TO CHECK SHARED DIR PERMISSION IN MIF FILE OF APPLICATION.
Thank you for you reply.
This "Shared" directory you mentioned, was already created with bitmaps and mp3 files that sample applications use. I guess I didn't create the file into the folder right.
THe debug error says: "unhandled exception in BREW_Emulator.exe: 0x0000005: Access Violation". What does this mean? Does that mean the file is not created?
if (ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pApp->m_pIFileMgr) == SUCCESS) {
IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize);
SPRINTF(filename, "%s/%s", AEE_SHARED_DIR, "catalog.xml");

Quote:Originally posted by navaltiger
mzichao,
Let me explain you how shared dir is managed.
You have brew application say HelloWorld, in directory say C:\myapp
There are 3 components.
1. MIF -> in our case it will be HelloWorld.mif which will be placed in c:\myapp, so path will be c:\myapp\HelloWorld.mif
2. DLL/MOD -> in our case it will be in directory HelloWorld, the path will be
c:\myapp\HelloWorld\HelloWorld.mif
Now you need to create "Shared" directory in c:\myapp so path will be C:\myapp\Shared. This directory is referred by AEE_SHARED_DIR.
MOST IMPORTANT THING HERE IS.. IF YOU ARE TRYING TO ACCESS SHARED DIR, CHECK THE PERMISSIONS IN MIF FILE. IF YOU WANT TO ACCESS IT, YOU NEED TO CHECK SHARED DIR PERMISSION IN MIF FILE OF APPLICATION.
Thank you for you reply.
This "Shared" directory you mentioned, was already created with bitmaps and mp3 files that sample applications use. I guess I didn't create the file into the folder right.
THe debug error says: "unhandled exception in BREW_Emulator.exe: 0x0000005: Access Violation". What does this mean? Does that mean the file is not created?
if (ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)&pApp->m_pIFileMgr) == SUCCESS) {
IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize);
SPRINTF(filename, "%s/%s", AEE_SHARED_DIR, "catalog.xml");

You might want to check out the API Reference guide for a description of how to use IFileMgr and IFile. If that's the code you're using, your IFile pointer hasn't been instantiated...

You might want to check out the API Reference guide for a description of how to use IFileMgr and IFile. If that's the code you're using, your IFile pointer hasn't been instantiated...

Quote:Originally posted by mohlendo
You might want to check out the API Reference guide for a description of how to use IFileMgr and IFile. If that's the code you're using, your IFile pointer hasn't been instantiated...
Where do I instantiate the IFile interface? You mean, I have to include the IFile in my sturcture?
IFile* pIFile = NULL;
I declared it in the webreadCB().
Thank you.

Quote:Originally posted by mohlendo
You might want to check out the API Reference guide for a description of how to use IFileMgr and IFile. If that's the code you're using, your IFile pointer hasn't been instantiated...
Where do I instantiate the IFile interface? You mean, I have to include the IFile in my sturcture?
IFile* pIFile = NULL;
I declared it in the webreadCB().
Thank you.

IFILEMGR_OpenFile() API will create IFile interface for you.

IFILEMGR_OpenFile() API will create IFile interface for you.

Quote:Originally posted by ruben
IFILEMGR_OpenFile() API will create IFile interface for you.
I created it already. But still, it only reads 1024 bytes. If I chang char buf[1024] to [5000], it still reads 1024. I know you should read in small chunks, I did that, could you see what's wrong with my reallocation? Thank you. I'm really out of idea....:(

Quote:Originally posted by ruben
IFILEMGR_OpenFile() API will create IFile interface for you.
I created it already. But still, it only reads 1024 bytes. If I chang char buf[1024] to [5000], it still reads 1024. I know you should read in small chunks, I did that, could you see what's wrong with my reallocation? Thank you. I'm really out of idea....:(

looking at WebReadCB() in your last post, in "default:" you are not creating a IFile instance (IFILEMGR_Open) in that case, so when you do IFILE_Write(), pIFile is still NULL.
you need to add the FileMgr_Open stuff in your default case as well, or, open the file before your WebReadCB(), put in your app data structure, and close it only after the last of the data gets written.
Also, at the end of the default case, it is falling through to the WebCleanup(), which you probably dont want to do since all bytes havent been read yet.. you should put a "return" at the end of the default case.
-Tyndal

looking at WebReadCB() in your last post, in "default:" you are not creating a IFile instance (IFILEMGR_Open) in that case, so when you do IFILE_Write(), pIFile is still NULL.
you need to add the FileMgr_Open stuff in your default case as well, or, open the file before your WebReadCB(), put in your app data structure, and close it only after the last of the data gets written.
Also, at the end of the default case, it is falling through to the WebCleanup(), which you probably dont want to do since all bytes havent been read yet.. you should put a "return" at the end of the default case.
-Tyndal

Quote:Originally posted by tyndal
looking at WebReadCB() in your last post, in "default:" you are not creating a IFile instance (IFILEMGR_Open) in that case, so when you do IFILE_Write(), pIFile is still NULL.
you need to add the FileMgr_Open stuff in your default case as well, or, open the file before your WebReadCB(), put in your app data structure, and close it only after the last of the data gets written.
Also, at the end of the default case, it is falling through to the WebCleanup(), which you probably dont want to do since all bytes havent been read yet.. you should put a "return" at the end of the default case.
-Tyndal
Thank you, Tyndal. I'm almost there..After I add "return", it can read in all the data. But still, it won't save to file.
I followed your direction, add IFILEMGR_Open to DEFAULT case, but now it only reads 1024 bytes again. What's wrong? Can you check? Thank you very much :D
default:
if (ByteCount)
{
if (pApp->m_BodySize + ByteCount > pApp->m_BodyAllocSize)
{
const int NewSize = pApp->m_BodyAllocSize + 1024; // 1024 is so that lesser calls to REALLOC is made. efficiency!//zcm
char* NewBuf = (char*)REALLOC(pApp->m_BodyBuffer, NewSize);
if (NewBuf)
{
pApp->m_BodyBuffer = NewBuf;
pApp->m_BodyAllocSize = NewSize;
}
}
if (pApp->m_BodySize + ByteCount <= pApp->m_BodyAllocSize)
{
MEMCPY(pApp->m_BodyBuffer + pApp->m_BodySize, buf, ByteCount);
pApp->m_BodySize += ByteCount;
}
}
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)(&pApp->m_pIFileMgr));
STRCAT( filename, AEE_SHARED_DIR );
STRCAT( filename, "/catalog.xml" );
pIFile = IFILEMGR_OpenFile(pApp->m_pIFileMgr, filename, _OFM_APPEND);
IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize); ISOURCE_Readable(pISource, &pApp->m_Callback);
return;
//switch end..
//end main if..(pWebRespInfo && WEB_ERROR_SUCCEEDED(pWebRespInfo->nCode))

Quote:Originally posted by tyndal
looking at WebReadCB() in your last post, in "default:" you are not creating a IFile instance (IFILEMGR_Open) in that case, so when you do IFILE_Write(), pIFile is still NULL.
you need to add the FileMgr_Open stuff in your default case as well, or, open the file before your WebReadCB(), put in your app data structure, and close it only after the last of the data gets written.
Also, at the end of the default case, it is falling through to the WebCleanup(), which you probably dont want to do since all bytes havent been read yet.. you should put a "return" at the end of the default case.
-Tyndal
Thank you, Tyndal. I'm almost there..After I add "return", it can read in all the data. But still, it won't save to file.
I followed your direction, add IFILEMGR_Open to DEFAULT case, but now it only reads 1024 bytes again. What's wrong? Can you check? Thank you very much :D
default:
if (ByteCount)
{
if (pApp->m_BodySize + ByteCount > pApp->m_BodyAllocSize)
{
const int NewSize = pApp->m_BodyAllocSize + 1024; // 1024 is so that lesser calls to REALLOC is made. efficiency!//zcm
char* NewBuf = (char*)REALLOC(pApp->m_BodyBuffer, NewSize);
if (NewBuf)
{
pApp->m_BodyBuffer = NewBuf;
pApp->m_BodyAllocSize = NewSize;
}
}
if (pApp->m_BodySize + ByteCount <= pApp->m_BodyAllocSize)
{
MEMCPY(pApp->m_BodyBuffer + pApp->m_BodySize, buf, ByteCount);
pApp->m_BodySize += ByteCount;
}
}
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)(&pApp->m_pIFileMgr));
STRCAT( filename, AEE_SHARED_DIR );
STRCAT( filename, "/catalog.xml" );
pIFile = IFILEMGR_OpenFile(pApp->m_pIFileMgr, filename, _OFM_APPEND);
IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize); ISOURCE_Readable(pISource, &pApp->m_Callback);
return;
//switch end..
//end main if..(pWebRespInfo && WEB_ERROR_SUCCEEDED(pWebRespInfo->nCode))

1) please surround your code by [code] [/code] tags so it is more readable.
2) You apparently removed your old code so i cant help you with it. please leave your code up for others reading the thread later on. (especially if you post your completed version after getting it to work) ... If it gets too long you could attach a text file instead.
3) you are apparently not releasing IFILE and IFILEMGR.. this could be causing your problem
-Tyndal

1) please surround your code by [code] [/code] tags so it is more readable.
2) You apparently removed your old code so i cant help you with it. please leave your code up for others reading the thread later on. (especially if you post your completed version after getting it to work) ... If it gets too long you could attach a text file instead.
3) you are apparently not releasing IFILE and IFILEMGR.. this could be causing your problem
-Tyndal

maybe something like this is what you are looking for
switch (ByteCount)
{
case ISOURCE_WAIT:
ISOURCE_Readable(pISource, &pme->pCallback);
return;
case ISOURCE_ERROR:
DisplayOutput(pme,ERR);
break;
case ISOURCE_END:
IFILE_Release(pme->pf);
UseFile(pme);
break;
default:
if (ByteCount)
{
IFILE_Write(pme->pf,buf,ByteCount);
ISOURCE_Readable(pISource, &pme->pCallback);
return;
}

maybe something like this is what you are looking for
switch (ByteCount)
{
case ISOURCE_WAIT:
ISOURCE_Readable(pISource, &pme->pCallback);
return;
case ISOURCE_ERROR:
DisplayOutput(pme,ERR);
break;
case ISOURCE_END:
IFILE_Release(pme->pf);
UseFile(pme);
break;
default:
if (ByteCount)
{
IFILE_Write(pme->pf,buf,ByteCount);
ISOURCE_Readable(pISource, &pme->pCallback);
return;
}

Quote:Originally posted by tyndal
1) please surround your code by [code] [/code] tags so it is more readable.
2) You apparently removed your old code so i cant help you with it. please leave your code up for others reading the thread later on. (especially if you post your completed version after getting it to work) ... If it gets too long you could attach a text file instead.
3) you are apparently not releasing IFILE and IFILEMGR.. this could be causing your problem
-Tyndal
I released FILEMGR and FILE in END case already, and I did that for DEFAULT case,too. But it still can't read into the file, it just read into filename. What could be the problem? Why is writing to file so difficult? Thank you.

Quote:Originally posted by tyndal
1) please surround your code by [code] [/code] tags so it is more readable.
2) You apparently removed your old code so i cant help you with it. please leave your code up for others reading the thread later on. (especially if you post your completed version after getting it to work) ... If it gets too long you could attach a text file instead.
3) you are apparently not releasing IFILE and IFILEMGR.. this could be causing your problem
-Tyndal
I released FILEMGR and FILE in END case already, and I did that for DEFAULT case,too. But it still can't read into the file, it just read into filename. What could be the problem? Why is writing to file so difficult? Thank you.

Quote:Originally posted by stefano
maybe something like this is what you are looking for
switch (ByteCount)
{
case ISOURCE_WAIT:
ISOURCE_Readable(pISource, &pme->pCallback);
return;
case ISOURCE_ERROR:
DisplayOutput(pme,ERR);
break;
case ISOURCE_END:
IFILE_Release(pme->pf);
UseFile(pme);
break;
default:
if (ByteCount)
{
IFILE_Write(pme->pf,buf,ByteCount);
ISOURCE_Readable(pISource, &pme->pCallback);
return;
}
I did that in END case, I just read it into a file, please see above codes for reference. Thank you.

Quote:Originally posted by stefano
maybe something like this is what you are looking for
switch (ByteCount)
{
case ISOURCE_WAIT:
ISOURCE_Readable(pISource, &pme->pCallback);
return;
case ISOURCE_ERROR:
DisplayOutput(pme,ERR);
break;
case ISOURCE_END:
IFILE_Release(pme->pf);
UseFile(pme);
break;
default:
if (ByteCount)
{
IFILE_Write(pme->pf,buf,ByteCount);
ISOURCE_Readable(pISource, &pme->pCallback);
return;
}
I did that in END case, I just read it into a file, please see above codes for reference. Thank you.

Please advise, I am SO close.......

Please advise, I am SO close.......

your problem is that it is only writing the first 1024 bytes to the file? Are any of your file methods failing??? if they fail, you simply return, so you have no way of knowing.. either step through your code, or add dbgprintfs to see if/where things are failing.
-Tyndal

your problem is that it is only writing the first 1024 bytes to the file? Are any of your file methods failing??? if they fail, you simply return, so you have no way of knowing.. either step through your code, or add dbgprintfs to see if/where things are failing.
-Tyndal

as tyndal wrote , what is your problem ?
are you reading only 1024 bytes from the socket ?
you are reading all bytes but writing only 1024 of them to file ?
i had similar problems (don't remember exactly what ), but
they were gone when i rewrote the code from scratch line by line,
in your code you are both writing for the END case , and for the default case , you are reallocating your buffer , that seems
to me you will have problem with the final data writen ,
eg
if you buffer has ALL the data in you need to do only one
IFILE_Write (CREATE mode), at the END
if you don't reallocate you need to IFILE_Write (APPEND mode)
any time your buffer gets filled,
stefano

as tyndal wrote , what is your problem ?
are you reading only 1024 bytes from the socket ?
you are reading all bytes but writing only 1024 of them to file ?
i had similar problems (don't remember exactly what ), but
they were gone when i rewrote the code from scratch line by line,
in your code you are both writing for the END case , and for the default case , you are reallocating your buffer , that seems
to me you will have problem with the final data writen ,
eg
if you buffer has ALL the data in you need to do only one
IFILE_Write (CREATE mode), at the END
if you don't reallocate you need to IFILE_Write (APPEND mode)
any time your buffer gets filled,
stefano

So, it goes into DEFAULT case, after read in all the data, go to END case to write to file? Is that correct?
Now, it reads in all the data (3072 bytes) from the buf to pApp->m_BodyBuffer. That means ALL the data is read in, right?
But the error appears in END case, filename is empty, so is the pIFile. Is the file created right? (please see bold section).
Also, how do you use dbgprintf() in this case to see whether the file is created? An ACTURAL example would be great, and where to put it in code, like:
dbgprintf(????????);
case ISOURCE_END:
if (pApp->m_BodySize < pApp->m_BodyAllocSize)
pApp->m_BodyBuffer[pApp->m_BodySize] = 0;
else
pApp->m_BodyBuffer[pApp->m_BodyAllocSize - 1] = 0;
if (pApp->m_BodyBuffer) {
if (ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)(&pApp->m_pIFileMgr)) == SUCCESS) {
/////////////////////////////////////
// Specify save directory here
// Specify file name/ format here
STRCAT( filename, AEE_SHARED_DIR );
STRCAT( filename, "/catalog.xml" );
//////////////////////////////////////
pIFile = IFILEMGR_OpenFile(pApp->m_pIFileMgr, filename, _OFM_CREATE);
IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize);
IFILE_Release(pIFile);
IFILEMGR_Release(pApp->m_pIFileMgr);
}//end if..(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR ,(void**)(&pApp->m_pIFileMgr) == SUCCESS)
}
WebCleanup(pApp);
break;
default:
if (ByteCount)
{
if (pApp->m_BodySize + ByteCount > pApp->m_BodyAllocSize)
{
const int NewSize = pApp->m_BodyAllocSize + 1024; // 1024 is so that lesser calls to REALLOC is made. efficiency! char* NewBuf = (char*)REALLOC(pApp->m_BodyBuffer, NewSize);
if (NewBuf)
{
pApp->m_BodyBuffer = NewBuf;
pApp->m_BodyAllocSize = NewSize;
}
}
if (pApp->m_BodySize + ByteCount <= pApp->m_BodyAllocSize)
{
MEMCPY(pApp->m_BodyBuffer + pApp->m_BodySize, buf, ByteCount);
pApp->m_BodySize += ByteCount;
}
}
ISOURCE_Readable(pISource, &pApp->m_Callback);
return;
//switch end..
//end main if..(pWebRespInfo && WEB_ERROR_SUCCEEDED(pWebRespInfo->nCode))
WebCleanup(pApp);

So, it goes into DEFAULT case, after read in all the data, go to END case to write to file? Is that correct?
Now, it reads in all the data (3072 bytes) from the buf to pApp->m_BodyBuffer. That means ALL the data is read in, right?
But the error appears in END case, filename is empty, so is the pIFile. Is the file created right? (please see bold section).
Also, how do you use dbgprintf() in this case to see whether the file is created? An ACTURAL example would be great, and where to put it in code, like:
dbgprintf(????????);
case ISOURCE_END:
if (pApp->m_BodySize < pApp->m_BodyAllocSize)
pApp->m_BodyBuffer[pApp->m_BodySize] = 0;
else
pApp->m_BodyBuffer[pApp->m_BodyAllocSize - 1] = 0;
if (pApp->m_BodyBuffer) {
if (ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)(&pApp->m_pIFileMgr)) == SUCCESS) {
/////////////////////////////////////
// Specify save directory here
// Specify file name/ format here
STRCAT( filename, AEE_SHARED_DIR );
STRCAT( filename, "/catalog.xml" );
//////////////////////////////////////
pIFile = IFILEMGR_OpenFile(pApp->m_pIFileMgr, filename, _OFM_CREATE);
IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize);
IFILE_Release(pIFile);
IFILEMGR_Release(pApp->m_pIFileMgr);
}//end if..(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR ,(void**)(&pApp->m_pIFileMgr) == SUCCESS)
}
WebCleanup(pApp);
break;
default:
if (ByteCount)
{
if (pApp->m_BodySize + ByteCount > pApp->m_BodyAllocSize)
{
const int NewSize = pApp->m_BodyAllocSize + 1024; // 1024 is so that lesser calls to REALLOC is made. efficiency! char* NewBuf = (char*)REALLOC(pApp->m_BodyBuffer, NewSize);
if (NewBuf)
{
pApp->m_BodyBuffer = NewBuf;
pApp->m_BodyAllocSize = NewSize;
}
}
if (pApp->m_BodySize + ByteCount <= pApp->m_BodyAllocSize)
{
MEMCPY(pApp->m_BodyBuffer + pApp->m_BodySize, buf, ByteCount);
pApp->m_BodySize += ByteCount;
}
}
ISOURCE_Readable(pISource, &pApp->m_Callback);
return;
//switch end..
//end main if..(pWebRespInfo && WEB_ERROR_SUCCEEDED(pWebRespInfo->nCode))
WebCleanup(pApp);

You should stick in some error checking code...what you have there looks pretty rickety. You can use DBGPRINTF() as I've shown below to inspect the file operations for failures. (caveat: I have not tried compiling this code)
Also, I'm not sure how you declared filename...was enough space allocated?
if (pApp->m_BodyBuffer)
{
if (ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)(&pApp->m_pIFileMgr)) == SUCCESS) {
/////////////////////////////////////
// Specify save directory here
// Specify file name/ format here
SPRINTF(filename, "%s/%s", AEE_SHARED_DIR, MY_XML_FILE);
//////////////////////////////////////
pIFile = IFILEMGR_OpenFile(pApp->m_pIFileMgr, filename, _OFM_CREATE);
if(pIFile)
{
if(!IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize))
DBGPRINTF("file write fail");
IFILE_Release(pIFile);
}
else
DBGPRINTF("file open fail (%d)", IFILEMGR_GetLastError());
IFILEMGR_Release(pApp->m_pIFileMgr);
}//end if..(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR ,(void**)(&pApp->m_pIFileMgr) == SUCCESS)

You should stick in some error checking code...what you have there looks pretty rickety. You can use DBGPRINTF() as I've shown below to inspect the file operations for failures. (caveat: I have not tried compiling this code)
Also, I'm not sure how you declared filename...was enough space allocated?
if (pApp->m_BodyBuffer)
{
if (ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR, (void **)(&pApp->m_pIFileMgr)) == SUCCESS) {
/////////////////////////////////////
// Specify save directory here
// Specify file name/ format here
SPRINTF(filename, "%s/%s", AEE_SHARED_DIR, MY_XML_FILE);
//////////////////////////////////////
pIFile = IFILEMGR_OpenFile(pApp->m_pIFileMgr, filename, _OFM_CREATE);
if(pIFile)
{
if(!IFILE_Write(pIFile, pApp->m_BodyBuffer, pApp->m_BodySize))
DBGPRINTF("file write fail");
IFILE_Release(pIFile);
}
else
DBGPRINTF("file open fail (%d)", IFILEMGR_GetLastError());
IFILEMGR_Release(pApp->m_pIFileMgr);
}//end if..(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FILEMGR ,(void**)(&pApp->m_pIFileMgr) == SUCCESS)

// Specify save directory here
// Specify file name/ format here
STRCAT( filename, AEE_SHARED_DIR );
STRCAT( filename, "/catalog.xml" );
I declared it like this, this should create a file, right?

// Specify save directory here
// Specify file name/ format here
STRCAT( filename, AEE_SHARED_DIR );
STRCAT( filename, "/catalog.xml" );
I declared it like this, this should create a file, right?

are you getting an actual error? if so, what its it?
how big is filename?
is it defined as something like:
filename[255];
is it big enough to hold the whole path?
perhaps your filename is causing problems... just try writing to "catolog.xml" , without the shared dir stuff first, after you get it working, then try and get the shared dir working.
do you have "File", "Write Access to Shared Directory", and "Web Access" privledges checked in the mif file?
Also, if the data will become large, you probably should be writing your file in parts, as you were doing before.. since a large Write call may not write all bytes at once.. But worry about doing that until after you get it to work.
-Tyndal

are you getting an actual error? if so, what its it?
how big is filename?
is it defined as something like:
filename[255];
is it big enough to hold the whole path?
perhaps your filename is causing problems... just try writing to "catolog.xml" , without the shared dir stuff first, after you get it working, then try and get the shared dir working.
do you have "File", "Write Access to Shared Directory", and "Web Access" privledges checked in the mif file?
Also, if the data will become large, you probably should be writing your file in parts, as you were doing before.. since a large Write call may not write all bytes at once.. But worry about doing that until after you get it to work.
-Tyndal

Thank you. I solved the problem.
It seems that STRCAT() doesn't work for me, I that's wierd. So I used :
SPRINTF(filename, "%s/%s", AEE_SHARED_DIR, MY_XML_FILE);
And the file appears in the shared folder.

Thank you. I solved the problem.
It seems that STRCAT() doesn't work for me, I that's wierd. So I used :
SPRINTF(filename, "%s/%s", AEE_SHARED_DIR, MY_XML_FILE);
And the file appears in the shared folder.