This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

fopen cannot write memroy card

I use lpc4357, and config file system & usb0 following the demo code of MCB4300.
The usb seems work, for I can read/write file via the usb interface.
When I create file failed by calling

fopen("TEXT.txt","w")

, it failed;
but, calling

fopen("TEXT.txt","rb")

seems ok (the return file handler not null if the file exist).
I just wander, what went wrong? Any idea is welcome!

Parents
  • Thanks for your reply, Vladimir Umek!
    You mentioned about "write protect switch"?
    It's hardware, or software?

    Oops, there's additional info updated:
    I cann't handle file with any of the options (read/write/...).
    Yes, I can get the file handler by calling

    fp = fopen ("TEXT.txt", "r")
    


    And It's not null, but I can do nothing to it, even calling

    num = fread(buff, 1, 10, fp)
    


    The num is 0, the buff is empty...
    But, I can read/write the sdcard via usb0...

    Just keep confusing...

Reply
  • Thanks for your reply, Vladimir Umek!
    You mentioned about "write protect switch"?
    It's hardware, or software?

    Oops, there's additional info updated:
    I cann't handle file with any of the options (read/write/...).
    Yes, I can get the file handler by calling

    fp = fopen ("TEXT.txt", "r")
    


    And It's not null, but I can do nothing to it, even calling

    num = fread(buff, 1, 10, fp)
    


    The num is 0, the buff is empty...
    But, I can read/write the sdcard via usb0...

    Just keep confusing...

Children
No data