Beispiel #1
0
ADAPTER_API AMChar* a_getcwd (AMChar* buffer, AMInt32 size)
{
    if(NULL == buffer)
        return NULL;
    else
    {
#if (defined (_WIN32_WCE) || defined(_WIN32)) && (!defined(__SYMBIAN32__)) 
        int index, i;
        AMChar* pwd = NULL;
        WCHAR wbuffer[256];
        GetModuleFileName(NULL, wbuffer, 256); 
        WideCharToMultiByte(CP_ACP, 0, wbuffer, wcslen(wbuffer), buffer, size, NULL, NULL);
        index = strlen(buffer);
        for(i = index; i > 0; i--)
        {
            if(buffer[i - 1] == '\\' || buffer[i - 1] == '/')
            {
                buffer[i - 1] = 0;
                break;
            }
        }
        return  buffer;
#else
        AMChar* pwd = getcwd(buffer, size);
#endif

#ifdef _DEBUG
        if(pwd == NULL)
             AMLogForError("a_getcwd", "a_getcwd() == NULL");
#endif
        return pwd;
    }
}
Beispiel #2
0
ADAPTER_API AMInt32 a_fseek(AMFILE * file, AMInt32 offset, AMInt32 flag)
{
    if(flag < AM_SEEK_SET || flag > AM_SEEK_SET || NULL == file)
        return AME_ARG_AINVALID;
    else
    {
        AMInt32 ret = fseek(file, offset, flag);
#ifdef _DEBUG
        if(ret != 0)
             AMLogForError("a_fseek", "fseek() != 0");
#endif
        return ret;
    }
}
Beispiel #3
0
ADAPTER_API AMInt32 a_fclose(AMFILE* file)
{
    if(file == NULL)
        return AME_ARG_AINVALID;
    else
    {
        int ret = fclose(file);
#ifdef _DEBUG
        if(ret != 0)
            AMLogForError("a_fclose", "fclose() != 0");
#endif
        return ret;
    }
}
Beispiel #4
0
ADAPTER_API AMInt32 a_ftell(AMFILE * file)
{
    if(NULL == file)
        return AME_ARG_AINVALID;
    else
    {
        AMInt32 pos = ftell(file);
#ifdef _DEBUG
        if(pos == -1)
             AMLogForError("a_ftell", "a_ftell() == -1");
#endif
        return pos;
    }
}
Beispiel #5
0
ADAPTER_API AMFILE* a_fopen(const AMChar* filename, const AMChar* flags)
{
    if(NULL == filename || NULL == flags)
        return NULL;
    else
    {
        FILE* filefd = fopen(filename, flags);
#ifdef _DEBUG
        if(filefd == NULL)
            AMLogForError("a_fopen", filename);
#endif

        return filefd;
    }
}
Beispiel #6
0
ADAPTER_API AMChar* a_getcwd (AMChar* buffer, AMInt32 size)
{
    if(NULL == buffer)
        return NULL;
    else
    {

        AMChar* pwd = (AMChar*)getcwd(buffer, size);
#ifdef _DEBUG
        if(pwd == NULL)
             AMLogForError("a_getcwd", "a_getcwd() == NULL");
#endif
        return pwd;
    }
}