locked
Header information RRS feed

  • Question

  • How to read header information of any file?
    Friday, July 30, 2010 7:38 AM

Answers

All replies

  • Hi,

    are you looking for AGETFILEVERSION() ?


    Gruss / Best regards -Tom 010101100100011001010000011110000101001001101111011000110110101101110011
    Friday, July 30, 2010 7:41 AM
    Answerer
  • Hi ChamW,
     
    "Any File" may have any file content. Some filetypes have header parts, other filetypes just have content. If you're looking for lowlevel file access, look at those functions starting with F:
    FOPEN(), FREAD() FWRITE(), FSEEK(), FGETS(), FPUTS() FCLOSE(), FCREATE()
     
    If you want to suck in a complete file, use FILETOSTR() which can store files up to 16 Mb into a memory variable.
     
     

    wOOdy
    Microsoft Visual FoxPro Technology Advisor
    Microsoft "Most Valuable Professional" from 1996 to 2009
    Visit my XING profile! Don't know what XING is?

    *´¨)
    ¸.·´¸.·*´¨) ¸.·*¨)
    (¸.·´. (¸.·` *
    .·`.Visual FoxPro: It's magic !
    (¸.·``··*


     

    Friday, July 30, 2010 8:00 AM
  • Actually my requirement is to identify the file type without any help of extension.

    As an example even we rename a XLS file in to a TXT file but actually the file type is XLS.

    I think I can identify the file type by reading the header information.

    Can use FOPEN(), FREAD() functions but someone can please tell me where those file type byte values are stored in the header file.

    Friday, July 30, 2010 8:28 AM
  • Hi ChamW
     
    >>  someone can please tell me where those file type byte values are
     
    Why someone? Why not you self? Just google for that information.... What is so difficult to search for "Magic number filetype header" ? Then you'll easily find:
     
     
    And maybe the best source:
     
     

    wOOdy
    Microsoft Visual FoxPro Technology Advisor
    Microsoft "Most Valuable Professional" from 1996 to 2009
    Visit my XING profile! Don't know what XING is?

    *´¨)
    ¸.·´¸.·*´¨) ¸.·*¨)
    (¸.·´. (¸.·` *
    .·`.Visual FoxPro: It's magic !
    (¸.·``··*


     

    Friday, July 30, 2010 10:10 AM
  • There is no way to absolutley identify file type. I can create a file with the proper header information for ANY file type, but the content can be meanngless. What is the ultimate goal?
    Craig Berntson
    MCSD, Visual FoxPro MVP
    INETA Regional Speaker
    www.craigberntson.com
    • Marked as answer by Alex Liang Friday, August 6, 2010 5:10 AM
    Friday, July 30, 2010 3:27 PM