On Sat, 2007-06-16 at 20:19 -0600, Ximsce wrote:
> Hi,
> 
> My application is trying to perform some simple file io, but when I try 
> to open the file I get a null return value.  I recall reading somewhere 
> in the docs that file io is working, but is there something special that 
> needs to be done for it to work (like path formatting)?  I tried using 
> wchar_t* for the path names, that didn't work, either.  In my code, the 
> path looks like this:
> 
> #define TEST_WAV_FILE "\"\\Storage card\\test_pda\\durga_wav\\horse.wav\""

Your message doesn't tell in which environment. Are you using
arm-wince-cegcc or arm-wince-mingw32ce tools ?

Also a simple test program would help things. I am attaching a simple
one which I have used a lot. It creates a file and writes about 20 lines
of text.

It could be simplified more but then I'd have to wake up before sending
this mail :-)

You may want to change the line that defines FN so it fits your PDA's
directory structure.

        Danny

-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define	FN	"/storage card/devel/fibo.txt"

int fibo(int n)
{
	if (n < 3)
		return 1;
	return fibo(n-1) + fibo(n-2);
}

int APIENTRY WinMain(HINSTANCE a,HINSTANCE b,LPWSTR c,int d)
{
	FILE	*f;
	int	i, r, len;
	wchar_t	*ws, buf[MAXPATHLEN];
	char	*s;

	f = fopen(FN, "w");
	len = GetModuleFileNameW(NULL, buf, MAXPATHLEN);
	s = malloc(len+1);
	wcstombs(s, buf, len+1);
	fprintf(f, "Command [%s] ", s);
	ws = GetCommandLineW();
	len = wcslen(ws);
	s = malloc(len+1);
	wcstombs(s, ws, len+1);
	fprintf(f, "param [%s]\r\n", s);

	for (i=1; i<20; i++) {
		r = fibo(i);
		fprintf(f, "fibo(%d) = %d\r\n", i, r);
	}
	fclose(f);
	exit(0);
}

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to