int putw ( int integer , FILE * stream );
Write an integer to a stream.
Writes a binary integer of type int to the stream and increases its position indicator to point to the next character.
putw assumes no alignment in the stream.
Notice that the length of int type depends on systems and compilers so this may cause some porting problems.
On success the integer value written is returned.
On error EOF is returned
Not defined in ANSI-C, but supported by many compilers.
Notice that the size of int may vary depending on system.
/* putw/getw example */
FILE * pFile;
pFile = fopen ("myfile.bin","wb+");
printf ("The double of %d is %d.\n", i, i*2);
This example creates a binary file called myfile.bin and stores
a numeric value on it. Then this value is retrieved and its double is printed.
This is done to emphatize that the type used is of type int and
not a string.
getw, printf, fwrite