int getw ( FILE * stream );
Get the next int value from a stream.
Returns the next value of type int from the stream and increases the position indicator of the stream to point the next character.
getw assumes no alignment in the stream and is not intended for use with files opened in text mode.
Notice that the length of int type depends on systems and compilers so this may cause some porting problems.
On success the integer read is returned.
If the End Of File is reached or there has been an error reading, the function returns an EOF character.
Because EOF is a valid integer, use feof() or ferror() to verify if an error has occurred or the End-Of-File has been reached.
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.
getc, putw, fread, fscanf