"Roberson" is my family name; "Walter" is my given name.
If i want to save the state information incaseof sudden power down,
which one is the better? Is it in File or in stream.
As far as the C language itself is concerned, streams are the
only things that exist.
In standard C, you start out with three predefined streams (stdin,
stdout, and stderr) and you can [try to] create additional streams by
using fopen().
The name you pass to fopen() is interpreted by the operating
system, which might happen to consider it to be the name of a file,
but might happen to consider it to be the name of something else
(such as a device or network connection. The C language itself
(and the routines in the standard C library) do not provide any
way to find out what kind of object was accessed: all your
program knows about it is that a stream was provided to access
whatever the underlying object really is.
Accordingly, in standard C, the question of whether to save to
a file or a stream is not very meaningful.
If you go outside of the C standard, your operating system
may provide additional routines to access specific kinds of
objects, or may make additional guarantees about what names
will correspond to what kind of objects: anything like that is
an extension to C, and the details of the extensions need to be
explored in a newsgroup more specific to your operating system.
*Generally* speaking, if you are in emergency powerfail operations,
then you do not have time to wait for a network connection to
be created (as that could take several minutes or might not
be available at all), so you usually want to save information to
something local. You probably want to save a minimal amount of
information as soon as possible, and possibly expand upon that if
you manage to get some spare time. You want the saved information
to be left in a consistant state, so you want to avoid having
a file open and being written to when the computer and operating
system run out of grace time, so your strategy might involve
several files.