Thread: how to make format...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    32

    how to make format...

    HI I seek for a website or someone to explain me what are format's????

    Like for example, I made some 3d models with someones program and made
    .3ds file, and if I took it to another program to load it and render it, it would say not a supporting format.

    this goes with the same thing with other files.

    What makes it a format, and how do people able to make a plug-in that would make the non supporting format to work with the software???

    and, how would I make such a thing.??

  2. #2
    Registered User
    Join Date
    Jul 2007
    Location
    Kansas, USA
    Posts
    12
    What you're really asking about is called a file extension, and it usually reflects the format of the file. The format is basically how the data is organized in the file. So to write a program to read data from a file, you have to know the internal structure of the file, which is unique to every file format. I've found www.wotsit.org somewhat useful, but it doesn't have everything.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    A file format is just a convention. The program is expecting the file to be in a specific format, which information lined up perfectly. For example, programs written in Java have 0xCAFEBABE as a number at the start of each .class file. This is how Java knows it's a valid .class file.

    Programs can only files in the format they expect them to be.

    It's just like writing a normal program that gives and receives input at the command line. If you ask the user for a number, and they enter "bleh" at the command line, what should your program do? Same concept.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    And there's nothing preventing someone from using an extension that's already been taken. Plug something into filext.com and you'll see what I mean. For example: http://filext.com/file-extension/1
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Registered User
    Join Date
    Jul 2005
    Posts
    32
    so it's nothing but how the file's data is structured??

    How would you create such files like if you were to make your own format??

    like if you make your own do you get to put your own .somthing extensions??
    for the file.

    then make a program that will accept that format??

    I am making a computer system from gound up like buying components ect and making a computer system, I want to make my own file system, and OS for it.
    and all files are to be created with my own formats.

    I am trying to learn the overall system of a computer so doing step by step, learning the stuff.

    if their are any tips or websites that would guide me in something what I am doing or at least have concepts of comptuers, where I could learn or help me along the way on building a computer system.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by hockey97 View Post
    so it's nothing but how the file's data is structured??

    How would you create such files like if you were to make your own format??

    like if you make your own do you get to put your own .somthing extensions??
    for the file.

    then make a program that will accept that format??
    Right.

    How would you design your own format? Well, there are a few things you'd want to keep in mind. The first is how are you going to distinguish this file type? Many file formats have a "signature", which is often a few characters at the beginning of the file indicating the format of the file. For example, a file's first two characters have to be "MZ" for Windows to consider it executable.

    As another example, PNG image files have an eight-byte signature. It's quite ingenious, really. It contains "PNG", so you know what it is just by looking at it. It also contains the DOS EOF character ^Z (26 decimal), so that if you type a PNG file from a DOS terminal, nothing will be printed beyond that. It's a nice feature, because PNG files are binary files and it wouldn't look nice on a terminal (plus you might miss the signature). It also contains an extended byte, that is, a byte that utilizes all eight bits. This is important for binary files, because if the file was transferred over a 7-bit connection, with the MSB discarded (would would be just fine for most text files), the PNG file would be messed up. Well, so would the signature, because it wouldn't be transferred properly. So just by looking at the signature a PNG reader can tell how it was transferred.

    Here's information on the PNG signature: http://www.libpng.org/pub/png/spec/1...Structure.html

    I really like the PNG format (can you tell? ), so I'll emphasize another important point with it: file formats have to be extensible. Inevitably, you're going to create a new version of the file format. What will you do then? Will you change the extension and go .format2, which is annoying? Will you use the same extension and have old versions of programs that process the format mess up on them? (If you used a signature, you could always change it. )

    PNG files are organized into blocks of a certain size. I won't go into details, but basically each block is of a certain type. If the reader doesn't recogize the block type, it can check a flag to see if the block is important. If the block is important, it can exit with an error message; but if it isn't, it can just ignore it and keep reading, safe in the knowledge that it can probably get the gist of the file without understanding that block.

    You don't have to do that -- it's just meant to be an example. PNG files are very extensible, so that when they come out with the next version, everyone won't have to upgrade their programs.

    [edit] Note that all of this PNG stuff is from memory, I may have misrepresented a few of the details. [/edit]

    You can register a format with Windows so that it will open with a certain program, and you can choose the icon, etc, if that's what you mean. Try Start->Control Panel->Folder Options->File types (for XP).

    I am making a computer system from gound up like buying components ect and making a computer system, I want to make my own file system, and OS for it.
    and all files are to be created with my own formats.

    I am trying to learn the overall system of a computer so doing step by step, learning the stuff.

    if their are any tips or websites that would guide me in something what I am doing or at least have concepts of comptuers, where I could learn or help me along the way on building a computer system.
    Just so you know, creating your own operating system is virtually impossible. It's the work of years for extremely good programmers.

    You might be able to do something easier, however, such as create your own shell, for example. Your shell might support certain commands, and handle certain file extensions differently. The nice thing about making something like this is that you can use the ordinary Windows console window for it.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Registered User
    Join Date
    May 2007
    Posts
    15
    hockey97, I would like to point you to http://www.osdever.net and http://www.osdev.org

    Both are good operating system development sites, I myself wrote a small hobby OS a few years ago, I never got to the phase where I needed to worry about file formats and interfacing with the hard drive, but let me tell you, getting the boot loader to boot, the kernel to load, the IRQs, ISRs, PIT, keyboard and display drivers working was tougher than I originally thought.

    I haven't worked my OS for about 2 years now, but I really would like to get back into it, but I don't because of practicality. It is a very good way to learn about the lowest levels of the computer (some assembly required can be taken to mean two things here), but yeah... Overall it is extremely fun, extremely challenging, and extremely time consuming.

    If you decide to write your own OS, the file formats are at least 2 years away (including research) if you do everything right and make sure things aren't done sloppy... So, now that I have given you a fair warning... go for it if you think you have it in you!

  8. #8
    Registered User
    Join Date
    Jul 2005
    Posts
    32

    Talking

    Thanks for the replies, I made the board of the motherboard of my own pc, I just want to see how the OS works ect and Runs by, doing it meaning making my own OS, I got a tv output becuse I am going to use one tv we don't use here just in case anything goes wrong I wouldn't care too much about that tv.

    I glanced over those sites look's great, I will start their, but I didn't see anything about a web browser. I know it's lengthy but just on the side when I have free time I plan on working on these thing's becuse I have fun with it and I am no longer having fun with playing video games or watching tv well maybe discover channel ect.

    If I get my OS done I will then focus on making web browsers and servers ect.

    just so I can really see what goes behind the scenes and how it works, it makes me have a better handle on error's or at least understand the computer more

    so if I get errors I can atleast understand them, if not at least know how and where to fix them.

    I have been using a computer ever since I was 4or 5.

    Thanks for your time, and replies..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. want to make this small program...
    By psycho88 in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2005, 02:05 AM
  2. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  3. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM
  4. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM
  5. Replies: 6
    Last Post: 04-20-2002, 06:35 PM