Find the answer to your Linux question:
Results 1 to 3 of 3
Hello Everyone, I'm working on an application in C/C++, and it requires files with a custom file extension. I was just curious about how to do this in Linux. In ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    2

    Question Custom File Extenstions


    Hello Everyone,

    I'm working on an application in C/C++, and it requires files with a custom file extension. I was just curious about how to do this in Linux. In Windows I could just create the files and the application using the file would be setup to interpret it, figure out what to do, etc., and it would work. Is it the same in Linux???? If not, could you describe it for me???

    Thanks
    ~ mike

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,133
    Strictly speaking that's not how it works. Filetypes are determined by their contents rather than their extension. If you take a jpeg for example and remove its file extension, it'll still be recognised as a jpeg. You can use the file command to identify a filetype but I would imagine in your case of a custom file format this might not exist.

    I think Gnome and KDE now have support for particular extensions rather than filetypes so you may be able to get by. Shell scripts on the other hand define their respective shell with a shabang
    Code:
    #!/bin/bash
    If the filetype in question is to be interpreted maybe you can have a similar definition as the file header?

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    2

    Smile

    Quote Originally Posted by bigtomrodney View Post
    Strictly speaking that's not how it works. Filetypes are determined by their contents rather than their extension. If you take a jpeg for example and remove its file extension, it'll still be recognised as a jpeg. You can use the file command to identify a filetype but I would imagine in your case of a custom file format this might not exist.

    I think Gnome and KDE now have support for particular extensions rather than filetypes so you may be able to get by. Shell scripts on the other hand define their respective shell with a shabang
    Code:
    #!/bin/bash
    If the filetype in question is to be interpreted maybe you can have a similar definition as the file header?
    Thanks. I think I'll be able to handle it fairly easily

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •