
-----------------------------------
Carey
Wed Mar 19, 2008 3:08 pm

File Type info
-----------------------------------
Is there a way in Turing to get the string associated with an extension? Ex. get "Microsoft word document" from ".doc". I could just hard-code it into a library file, but file types differ on each computer. Is there a way to get the information when the program starts up?

-----------------------------------
Sean
Wed Mar 19, 2008 3:10 pm

Re: File Type info
-----------------------------------
Have you looked into the import function?

-----------------------------------
Mackie
Wed Mar 19, 2008 5:54 pm

RE:File Type info
-----------------------------------
Vilament, I think you misunderstood. To answer your question. There is no function to do that. If you have the name in a string already in a string you could probably just collect the file extension running backwards through the string and collecting every letter before you run into a period.

-----------------------------------
TheGuyWhoGotOn
Fri Mar 21, 2008 11:39 am

Re: RE:File Type info
-----------------------------------
Vilament, I think you misunderstood. To answer your question. There is no function to do that. If you have the name in a string already in a string you could probably just collect the file extension running backwards through the string and collecting every letter before you run into a period.

It sounds like he want something like


File := File(* - 4 .. *)
if File = ".doc" then
put "kewl"
end if


Or will that not work?

-----------------------------------
Tony
Fri Mar 21, 2008 12:49 pm

Re: File Type info
-----------------------------------
string associated with an extension? ... differ on each computer.
The association is on the OS level. That is, I can configure the system to open .doc documents with Notepad. Or even one specific .doc document, while leaving the rest with default. There might be OS API for this information, but such is generally not available to Turing.

-----------------------------------
Carey
Tue Mar 25, 2008 11:11 am

RE:File Type info
-----------------------------------
Crap. [moves on to C++] Well thanks anyway.
