how to read .txt file? | developer.brewmp.com how to read .txt file? | developer.brewmp.com

Developer

how to read .txt file?

Forums:

hello all ,
I have a .txt file?
I want that if I click any menu then text of .txt file should on mobile screen?

I want to create whole code in a function which i will call on menu?

plz help

Hi
it's easy u Can do It by IFile
i am giving one example..................
unsigned char* readdata(char *fileURL)
{
//Create a buffer to read data
unsigned char* fileDataBuffer = NULL;
//File Manager
IFileMgr* pIFileMgr;
ISHELL_CreateInstance(pApp->m_pIShell, AEECLSID_FILEMGR, (void**) IFileMgr);
if (!pIFileMgr)
{
return fileDataBuffer;

IFile* pIFile;
pIFile = IFILEMGR_OpenFile(pIFileMgr, fileURL, _OFM_READ);
if (pIFile == NULL)
{
///DBGPRINTF("loadFileData pIFile == NULL");

IFILEMGR_Release(pIFileMgr);
FREE(pIFileMgr);
FileInfo fileInfo;
IFILE_GetInfo(pIFile, &fileInfo);
fileDataBuffer = (unsigned char*)MALLOC(fileInfo.dwSize);
IFILE_Read(pIFile, fileDataBuffer, fileInfo.dwSize);
IFILE_Release(pIFile);
FREE(pIFile);
return fileDataBuffer;
//it will return the data

Hi
it's easy u Can do It by IFile
i am giving one example..................
unsigned char* readdata(char *fileURL)
{
//Create a buffer to read data
unsigned char* fileDataBuffer = NULL;
//File Manager
IFileMgr* pIFileMgr;
ISHELL_CreateInstance(pApp->m_pIShell, AEECLSID_FILEMGR, (void**) IFileMgr);
if (!pIFileMgr)
{
return fileDataBuffer;

IFile* pIFile;
pIFile = IFILEMGR_OpenFile(pIFileMgr, fileURL, _OFM_READ);
if (pIFile == NULL)
{
///DBGPRINTF("loadFileData pIFile == NULL");

IFILEMGR_Release(pIFileMgr);
FREE(pIFileMgr);
FileInfo fileInfo;
IFILE_GetInfo(pIFile, &fileInfo);
fileDataBuffer = (unsigned char*)MALLOC(fileInfo.dwSize);
IFILE_Read(pIFile, fileDataBuffer, fileInfo.dwSize);
IFILE_Release(pIFile);
FREE(pIFile);
return fileDataBuffer;
//it will return the data