Within a C# program, is there any way to tell if a file is a text file or not? I mean a real way, not just basing your conclusion on a file name extension.
BobLewiston 0 Junior Poster
Recommended Answers
Jump to PostYou can look inside the file and see what's there. If it conforms to your expectations -- if the file or the first 1000 bytes of the file contains only characters that conform to one of some particular set of character encodings, maybe you have a text file.
Jump to PostRashakil Fol gave the only thing else i could think of ...
But using "*.txt" will work fine ?
Jump to PostSure, but its not a guarentee doesnt stop people adding a .txt extension to anything
All 10 Replies
Rashakil Fol 978 Super Senior Demiposter Team Colleague
cVz 19 Junior Poster
LizR 171 Posting Virtuoso
Ramy Mahrous 401 Postaholic Featured Poster
LizR 171 Posting Virtuoso
Ramy Mahrous 401 Postaholic Featured Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
Ramy Mahrous 401 Postaholic Featured Poster
LizR 171 Posting Virtuoso
Ramy Mahrous 401 Postaholic Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.