Be sure you are requesting the WRITE_SDCARD permission, which is needed for
an application to be able to modify data in the SD card.

On Fri, Dec 4, 2009 at 3:56 AM, KK <[email protected]>wrote:

> Hi,
>
>  I am very new to Android. I am trying the following code in the
> android ndk.
>
> FILE* fp = fopen("/sdcard/test", "wb")
> if(NULL == fp)
> {
>  return errno;
> }
> int written = fwrite("Test", 1, 4, fp);
> if(4 != written)
> {
>  return -1;
> }
> fclose(fp);
>
> return 0;
>
> I am trying this on emulator and I have created and sdcard for the
> emulator. The function returns 0. When I check the sdcard, a file with
> the name is created, but it is empty. Can anyone please help me on
> this?
>
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to