Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 File Type info
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Carey




PostPosted: Wed Mar 19, 2008 3:08 pm   Post subject: 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?
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Wed Mar 19, 2008 3:10 pm   Post subject: Re: File Type info

Have you looked into the import function?
Mackie




PostPosted: Wed Mar 19, 2008 5:54 pm   Post subject: 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




PostPosted: Fri Mar 21, 2008 11:39 am   Post subject: Re: RE:File Type info

Mackie @ Wed Mar 19, 2008 5:54 pm wrote:
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

code:

File := File(* - 4 .. *)
if File = ".doc" then
put "kewl"
end if


Or will that not work?
Tony




PostPosted: Fri Mar 21, 2008 12:49 pm   Post subject: Re: File Type info

Carey @ Wed Mar 19, 2008 3:08 pm wrote:
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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Carey




PostPosted: Tue Mar 25, 2008 11:11 am   Post subject: RE:File Type info

Crap. [moves on to C++] Well thanks anyway.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: