2008/10/23 Vincent Torri <[EMAIL PROTECTED]>
>
> > The program and the file (the latter begin named foo) are in the same
> > directory. If I just pass 'foo' to fopen(), NULL is returned. If I pass
> > the full path '\efl\foo', fopen succeeds.
> >
> > Is it a known behavior ?
>
> i've just written a small test :
>
>
> #include <stdio.h>
>
> int main()
> {
> FILE *f;
>
> f = fopen("glassy_nocomp.edj", "rb");
> if (!f)
> {
> printf("relative path: error\n");
> }
> else
> {
> printf("relative path: success\n");
> fclose(f);
> }
>
> f = fopen("\\efl\\glassy_nocomp.edj", "rb");
> if (!f)
> {
> printf("full path: error\n");
> }
> else
> {
> printf("full path: success\n");
> fclose(f);
> }
>
> return 0;
> }
>
> with cegcc, no problem, f is never NULL
> with mingw32ce, f is NULL when using relative path, and not NULL when
> using full path
>
> Vincent Torri
>
Hi Vincent,
Yep you're right. WinCE does'nt support relative path. Welcome in microsoft
World :P
I try your code on a winCE target, and f is always NULL for relative path.
Attached a program that retrieve relative path. It works fine on my target.
I have not test it with cegcc, only with VS2005.
Regards
--
Nicolas Aguirre
Mail: [EMAIL PROTECTED]
Web: http://www.digital-corner.org
#include <stdio.h>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
FILE *f;
wchar_t wFileName[MAX_PATH];
char strFileName[MAX_PATH];
wchar_t* pTemp;
f = fopen("./test.txt", "rb");
if (!f)
{
printf("relative path: error\n");
}
else
{
printf("relative path: success\n");
fclose(f);
}
f = fopen("\\HD002\\TESTS\\test.txt", "rb");
if (!f)
{
printf("full path: error\n");
}
else
{
printf("full path: success\n");
fclose(f);
}
GetModuleFileName(NULL,wFileName,MAX_PATH);
pTemp = wcsrchr(wFileName,L'\\');
if(pTemp != NULL)
{
*pTemp = 0;
}
else
{
printf("Error retrieving path\n");
return -1;
}
wcscat(pTemp,L"\\");
sprintf(strFileName,"%S%s", wFileName, "test.txt");
f = fopen( strFileName, "rb");
if (!f)
{
printf("relative path: error\n");
}
else
{
printf("relative path: success\n");
fclose(f);
}
return 0;
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Cegcc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cegcc-devel