Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have data files with fixed extensions. Sometimes (I know; this should not happen) these are simple text files, sometimes however these are realy Excel-files-in-disguise (could be 2003, 2007) in general I'd say: binary files.

    Is there a little piece of simple code in VB that I can use to quickly determine this (or see if a file is a text file)? I know I can search for non-ASCII in e.g. the first 100 chars (except Tab, CR, LF of course). Then I could look for CR and/or LF or CR/LF in the first 100 chars. I think both of these are not full-proof however. any idea or suggestion would be appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I'd look for ASCII character 0 in the first 50 or 100 bytes. If present, it's not a text file.

Posting Permissions

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