I just tried ntohl() in my program and this works perfectly. I think I
will use this method. I want to thank everyone who replied for all of
their great ideas! This help is greatly appreciated.
<off-topic reason="potential bug">
Be careful: ntohl() does *not* do what you asked.
It converts "network byte order" (Big-Endian) to "host
byte order" (whatever your machine uses). If your
machine uses Big-Endian byte order already, ntohl()
will not swap the bytes: it will do nothing at all.
To put it another way, ntohl() may in fact do what you
want on the machine you're using at the moment, but
will definitely *not* do what you want on all machines.
If you need to swap the bytes unconditionally, no
matter what machine you're using, you'll have to work
a little harder.
</off-topic>