to keep files after kernel rebooting

i need to use reboot() system call (to reboot the kernel 2.6.29 with ARM) and i tried the code below:

#include <stdio.h>
#include <linux/reboot.h>
#include <unistd.h>
int main()
{
    reboot(LINUX_REBOOT_CMD_RESTART);
}

it works well! but what im wondering is after rebooting the kernel im loosing the files being saved. i mean if use this code, "url" file is not saved after reboot.

int main()
    {
        FILE *pFile = fopen("url", "a"); // for .txt file
        // write to file/read from file ... etc
        fclose(pFile);

        int fdUART = open("/dev/ttySAC0", O_RDWR | O_NOCTTY | O_NDELAY);
        // some operations on UART port
        close(fdUART);
        /* Ethernet raw package process*/
        /* Char dev driver open and communicate with FPGA fifo */
        /* so on */
        reboot(LINUX_REBOOT_CMD_RESTART);
    }

and am using the UART, Ethernet, char drivers and just would like to know reboot() call systems's effect to my system.

any help highly appreciated thanks.

Answers


You've written in the comments that the file system is cramfs.

From the Wikipedia page for cramfs:

The compressed ROM file system (or cramfs) is a free (GPL'ed) read-only Linux file system designed for simplicity and space-efficiency. It is mainly used in embedded systems and small-footprint systems.

Note that it's read-only: that means your changes won't be preserved.

You'll need to write to persistent storage to have your changes preserved.


Need Your Help

distributing independent python app to other machines

python distribution cx-freeze

I created independent python app using cxfreeze under linux and can run it other machines without python and other dependencies.

Text in front of variables inside a foreach loop

php sql mysql html

I have set up a small script to handle a page where I have three checkboxes.