Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IsThisFileaText() -or- IsThisFileaZip()
Message
From
08/05/2002 09:07:57
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00653721
Message ID:
00653943
Views:
27
>>If anyone has an idea of determining a file type, regardless of file extention, please share it here...
>>
>>Types to recognize -
>>Text
>>Zip
>>Bmp
>>PDF
>>or none-of-the-above
>>
>>TIA
>
>To "start" you:
>
>BMP start with "BM"
>ZIP start with "PK"
>PDF start with "%PDF"
>TXT start with anything! :-)

TXT can start with anything, but if you find several repetitions of chr(13) + chr(10), say, within the first thousand bytes, then it is very likely a text-file. Well, perhaps you want to exclude other options first, such as HTML files.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform