How to make own file formats?

I dont have any idea about file formats…Where can I get some info on how to make my own formats?

I think you should be a bit more specific,
what kind of fileformat. The definition of ‘Fileformat’ is: The manner in which a file is formatted, this gives a whole room of possibilities!

Actually it is even possible to make an infinitely amount of fileformats…
But I guess this would be kind of off topic.



[This message has been edited by DPalomo (edited 08-01-2000).]

Well … what do you want to do?

Ok. I want to have a file with a lot of textures to use with OGL. For example a Zip file. What should I do to make my own Zip extractor? I have the info about ZIP file formats but I dont know what to do with that. Where can I find info?

Like a PK3 file (Quake 3). PK3 are actually Zip files.

you’re on a mission!

So, what happens when you extract your textures out of the zip file? have you got a loader for the actual texture file format? (*.bmp, *.jpeg etc…)

If you’re not sure about file format loaders, I’d recommend getting to grips with textfiles first, followed by uncompressed binary files before attempting compressed files.

I wrote a gif file loader for the hell of it. But as a compressed format, they quite often use random sizes of data (eg 3 bits, etc)

An uncompressed format usually will keep data to standard sizes of char, float, int, long etc. These are a lot easier to use with functions like fread.

The other thing to bear in mind is which endian is the machine you saved the data in, and the way that you are reading it.

A machine can either be Big or Little endian, this is the way in which the bits are organised in bytes. (Is the bit that represents the biggest number on the left or right?)

I’ve got some example files I’ve written for the loading of text files, and some basic binary files. Mail me if you want them.

Spend a lot of time looking in C and C++ books at the chapters on file loading. Pay particular attention to opening and reading binary files and give it a go…

but I’d recommend writing some kind of texture file loader first, then write a zip loader, to export the zip, and then read the textures.

[This message has been edited by Rob The Bloke (edited 08-01-2000).]

[This message has been edited by Rob The Bloke (edited 08-01-2000).]