Thread: File Format

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    11

    File Format

    I wanna make a program to change the file format from
    x to y
    since i'm quite new and i'm not too sure about how to do it do you know of any tutorials that can explaing to me how to change from one format o another any type of format doesn't really matter

    Thank you

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Start by being specific about what x and y are

    http://www.wotsit.org/ has lots of info on file formats
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    11
    the x and y would be
    .mdl to .3ds
    but i don't care on the tutorial as any would do i just wanna see how you do it so i can then work from mdl to 3ds

    thanks for the website anyway

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Unhappy This could be REALLY involved...

    In general:

    1- Read-in the file.
    2- Decode (convert) the file into a intermediate format.
    3- Convert the data into the new format.
    4- Save the new format.

    You may be able to skip the intermediate format. (For example, you will need an intermediate format if both formats use different methods of file-compression.)

    It may be desirable to convert the file a little at a time, rather than all at once. This may be impossible with some file formats.

    I don't know anything about the .mdl or 3ds formats, so the following is very general, and I wouldn't want to discourage anyone from attempting something just because it might be difficult... But, most file formats are rather complex with lots if conditional logic and options (if this... then that). This type of program is going to take more than a few hours to write... I would guess that it would take me at least a couple of weeks of full-time research, study, and programming... maybe much longer!

    Note: Many file formats are proprietary (secret) and/or require a license ($).

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Depends on the file type...I'm sure changing between two different simple image types wouldn't be that involved (might be a good place to start learning)...The types of files that you want to work with would definitely be complicated and take some time to learn

    Its a very good thing to learn different file formats, though (in my opinion)
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Originally posted by JaWiB
    Depends on the file type...I'm sure changing between two different simple image types wouldn't be that involved (might be a good place to start learning)...
    You've got to be kidding! The header information might be able to be converted to a degree, but the image data for the formats cannot simply be plugged into different headers. .JPG, .GIF, .PNG, etc. all have totally different schemes to store image information and they aren't compatible at all. You'd have to convert from compressed format to uncompressed form (basically a BMP) the recompress to the new form. Not trivial.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  7. #7
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    He said simple, like BMP<->TGA, for example.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  8. #8
    Registered User
    Join Date
    Aug 2003
    Posts
    11
    Unfortunatly it won't be anything too easy the file that I wanna transfer are 3d files uno of the the (3ds) is the 3D Studio file format the other one (MDL) is MS Flight Sim Compiled aircraft file is a RIFF file so I heard that is not too hard too handle and also i can convert it into an X file at first, do you think is too hard cause i'm not really an "expert"

  9. #9
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    do you think is too hard
    You'll have to answer that yourself...

    If you don't know how to read-in a text file, encrypt it (using some encryption method of your choice), save it, read it back-in and decrypt it... this is too hard for you.

    If you read the file format documents, and you don't have a clue what they mean, this is too hard for you. (These types technical specification documents usually require slow-careful reading and re-reading... So, I'm not saying that you need to understand all of it with one quick reading.)

    If you study the file format documents, and you understand them (or 90 percent of it) then this project is not too hard for you.

    If after studying the file formats, you can read-in a file and mamipulate it in some way (change the size or colors), then this may not be to hard for you.

  10. #10
    Registered User
    Join Date
    Aug 2003
    Posts
    11
    would you know of any places where I can find some tutorials cause i have a book C++ in 21 days but i don't think is that good since it doesn't even explain how to write a file I had to go and look for that somewhere else, I really wanna do this program no matter how long it takes

    Thanks

  11. #11
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I guess fstream's were on the 22nd day

    gg

  12. #12
    Registered User
    Join Date
    Aug 2003
    Posts
    11
    Originally posted by Codeplug
    I guess fstream's were on the 22nd day

    gg
    Well you're not that wrong since the fsream are on another book from the same author and the same publishing company

  13. #13
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you don't already know C++, and you've just decided that the only reason you need to learn C++ is to complete that task, then you're going about it the wrong way.

    If you actually don't care about the programming that much, and are just after a solution, then a quick google found this
    http://www.3dlinks.com/links.cfm?cat...bcategoryid=11
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM