![]() |
|
#1
|
|||
|
|||
Identifying file typesWithin 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.
|
|||
|
#2
|
|||
|
|||
Re: Identifying file typesIt would be in the file header, its the first x bytes (I can't remember how many 'x' is - maybe 2).
Test by, creating a text file, read it into a byte array and check the first two bytes. Then create another one and see if it matches the first two bytes. If so you've got your file signature. |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 08:44 |
| After execution - Error cannot locate /Skin File? | WSCH | C++ Forum | 1 | 05-Mar-2005 21:03 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 11:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 12:28 |
| CD Buring Failed | skanth2000 | Computer Hardware Forum | 1 | 15-Nov-2003 04:52 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The