|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: fread() function and unsigned integers, words and dwords
here is how fread works:
fread( the buffer to hold what you are reading in,
the size of the data you are reading in,
the amount of the size you just specified,
the file pointer);
here is an example
fread(&buffer, sizeof(DWORD), 10, filePointer);
That would read in 10 DWORD's. if you want integer, say sizeof(integer)....
get it?
fread is a great function.
the file pointer is the variable "FILE *filePointer" that you declare if you
are reading from a file.
Let me know if you need more explaining and I would be happy to write a
SIMPLE example.
i am good at that :)
Ben Humphrey
Game Programmer
WebHost of www.GameTutorials.com
benh@humongous.com
benjina@mindspring.com
----- Original Message -----
From: Lionel Pinkhard <lionelpi@mweb.co.za>
To: <gameprogrammer@gameprogrammer.com>
Sent: Monday, July 17, 2000 3:39 PM
Subject: fread() function and unsigned integers, words and dwords
> Hi,
>
> Can somebody please explain to me how the fread() function works? I looked
> at the stdio.h file, but I can't make out exactly which parameters to pass
> to it. Is it similar to fgetc() and fgets()? Would it work to input
> unsigned integers, words and dwords from files? Also, I know how to
declare
> a variable as an unsigned integer, but what would I have to do to make it
a
> word or dword? Would I have to use a char/int/long/float/double? Or what?
> I'm trying to read a header file, any ideas? I'm using a struct for the
> header.
>
> Kind regards,
>
> Lionel Pinkhard
> =================================================================
> The GameProgrammer.Com mailing list is for the open discussion
> of any topic related to the art, science, and business of
> programming games. This list is especially tolerant of beginners.
> We were all beginners once
>
> To SUBSCRIBE or UNSUBSCꫨ please visit:
> http://gameprogrammer.com/mailinglist.html
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once
To SUBSCRIBE or UNSUBSCꫨ please visit:
http://gameprogrammer.com/mailinglist.html
|
|