Hi freakingtux,

             I din tried different calls i tried only f open. Ya in my
app i added the permission to write to external storage and my app
works fine in emulator and creates the file.

On May 27, 10:17 am, freakingtux <[email protected]> wrote:
> Hi
>
>
>
> On Thursday, May 26, 2011 1:42:37 PM UTC+2, Gopi wrote:
>
> > Hi,
> >    I m trying to write log to sdcard. I have created a native service
> > that starts during boot and i want it to write a log file to
> > sdcard..my c file looks like this logservice.c
>
> > #define LOG_TAG "Log Service"
> > #include <cutils/log.h>
> > #include <unistd.h>
> > #include <stdio.h>
> > int main(int argc, char **argv)
> > {
> > FILE *file;
> > file = fopen("/data/all.log","a+");
> > fprintf(file,"%s","My Service started - My check");
> > fclose(file);
> > return 0;
> > }
> > I have changed the r/w permission to all for sdcard also using chmod
> > 777.
> > the app creates a file in sdcard
>
> Can you try and check the return values of the different calls the fopen is
> most probably failing and you can get very clear errors on this type of
> stuff
> Does you application request(or get)
> android.permission.WRITE_EXTERNAL_STORAGE ?
>
> is /data in your code equals your external storage directory?
>
> Greetings

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to