File Loading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • compman9902
    New Member
    • Mar 2007
    • 105

    File Loading

    Is there any way to load a file with a suffix other than ".txt" like a text file? If not, how do you load files with other suffixes and in what format does data come out of them?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by compman9902
    Is there any way to load a file with a suffix other than ".txt" like a text file? If not, how do you load files with other suffixes and in what format does data come out of them?
    Sure, feel free to create a file text.o that contains just text of create file bin.txt
    that contains just binary data. Extensions are just a human convention but the
    files themselves can store anything you like and you can read them as you like.
    Extensions don't tell you anything.

    kind regards,

    Jos

    Comment

    • boxfish
      Recognized Expert Contributor
      • Mar 2008
      • 469

      #3
      To load a file other than a text file, you should open it in binary mode, just to be safe. You have to research the file format first (usually you can just google it), and then you have to write code that can read in the file and store the image/sound/music/whatever in the data structure you are using. Some formats are easier to load than others, and some of them are copyrighted. Files like images and sound usually don't look like much in text format. Here is an excerpt from my avatar:
      Ì3Ì3Ì3ÿ3fÿ fÌfÿ3ÿ™f™™™ÿ3™™ ÿ3ÿÌ3 !ÿ NETSCAPE2.0 !ù , 2 2 ÿ «X™# € 0 !€ 0 @ €‹+j0âÁB…zp aÑ"–'<v 
      Hope this makes sense.

      Comment

      • compman9902
        New Member
        • Mar 2007
        • 105

        #4
        Originally posted by boxfish
        To load a file other than a text file, you should open it in binary mode, just to be safe. You have to research the file format first (usually you can just google it), and then you have to write code that can read in the file and store the image/sound/music/whatever in the data structure you are using. Some formats are easier to load than others, and some of them are copyrighted. Files like images and sound usually don't look like much in text format. Here is an excerpt from my avatar:

        Hope this makes sense.
        Actually this makes a lot of sense. Thanks for replying to my post. As a matter of fact, I have opened many files in notepad, just to see what their guts look like. In one case, it crashed my computer! (Its was a 50 megabyte mpeg movie file, on a very old computer).

        Comment

        • boxfish
          Recognized Expert Contributor
          • Mar 2008
          • 469

          #5
          I have the sound editor Audacity, and it lets me import any file as sound data. Excecutables and bitmap images sound the best.

          Comment

          Working...