Hi All,

I'm having trouble running the following code on my Axim X51v:

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define FN  "fibo222.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);
}


The issue is that fprintf / fputs / fwrite don't work, and program aborts on
them.

* Running Ubuntu 7.04

* Compiled using the following line:
arm-wince-cegcc-gcc testit.c -o testit.exe

* fopen works and returns non-NULL value

* lower level open / write work w/o problem

Also tried the following code, with similar results:

#include <stdio.h>

int main(int argc,char *argv[]) {
    FILE *f1=fopen("testit.txt","wt");
    fprintf(f1, "blah blah blah");
    fclose(f1);
    return 0;
}

The same code works just fine in 0.50.

Any suggestions are greatly appreciated.

Thanks and best regards,
-Pavel
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to