简体   繁体   中英

Windows Phone 8 and read/write file

My application have a small piece of code which read/write a file in C++/CX (Windows Phone 8 Interop DirectX) like this:

bool WriteState(char *fileName) {
    FILE *fp = fopen(fileName);
    if (fp) {
        // Do save
        ...
        fclose(fp);
        return true;
    }

    return false;
}

and ReadState has the same code. and invoking (call from C#):

ObjectClass game = new ObjectClass();
game.WriteState("game1.state");

It's no problem when I run on my device, debug with no error. But after I published to Windows Phone Store and install to my device, the Read/Write code doesn't work. Why this happen?

Make sure you aren't saving the file in its install location. Your app won't have access to its install location in production. You'll need to save in isolated storage.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM