Re: Ascii or Binary File??
From: willem van Deursen (noname_at_noname.nl)
Date: 09/10/04
- Next message: Leonel: "Re: Ascii or Binary File??"
- Previous message: Rich Ackerson: "Re: ABC6 Tools For Delphi6?"
- In reply to: Leonel: "Re: Ascii or Binary File??"
- Next in thread: Leonel: "Re: Ascii or Binary File??"
- Reply: Leonel: "Re: Ascii or Binary File??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 10 Sep 2004 18:53:10 +0200
You should check the file for any character that is not in the range
'A'..'Z','a'..'z','0'..'9' and all the special characters that you would
allow (such as ':',';','<') and so on. If you encounter one character
thats not allowed, then its binary. However, even if you encounter only
allowed characters, theres no way to be absolutely sure whether the file
should not be interpreted as binary
'AwwQ!!33234##' might be interpreted as all valid text characters, but
it is likely to be a binary file, so no guaranteed result...
Willem van Deursen
Leonel wrote:
> Nick Rollas wrote:
>
>
>>Is it possible to know if a file is Ascii or Bin? I'm writting an FTP
>>Client and i want to determinate whether the file is binary or text.
>
>
> A comment I just copied from Abbrevia source code:
>
> the test for whether a stream is binary or not is to
> check whether there are any #0 characters in the first
> 1024 bytes: if there are the stream is binary.
>
> To know for sure, you'd have to read the whole file. To guess, you
> might try a similar way as described above.
>
-- Willem van Deursen, The Netherlands wvandeursen_nospam@nospam_carthago.nl replace _nospam@nospam_ for @ to get a valid email address www.carthago.nl
- Next message: Leonel: "Re: Ascii or Binary File??"
- Previous message: Rich Ackerson: "Re: ABC6 Tools For Delphi6?"
- In reply to: Leonel: "Re: Ascii or Binary File??"
- Next in thread: Leonel: "Re: Ascii or Binary File??"
- Reply: Leonel: "Re: Ascii or Binary File??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|