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

Username:   Password: 
 RegisterRegister   
 closing file stream during early program termination (matlab)
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chopperdudes




PostPosted: Fri May 06, 2011 1:18 am   Post subject: closing file stream during early program termination (matlab)

i've only seen turing do this on its own... how do you close a stream when the user decides to interrupt and end the program? reason being i'm working on a matlab script file which communicates using TCP/IP with another program, when something doesn't go right, i.e. infinite loop and i have to end it myself (ctrl c), matlab would leave the port hanging and so i would have to restart the other program. are there any ways to do this? or work arounds? (i.e. have a thread running and detect a keyboard input which will terminate the program). right now it may be development inconvenience, but i'm pretty sure this problem will actually lower the usefulness of the matlab program.

thx
Sponsor
Sponsor
Sponsor
sponsor
mirhagk




PostPosted: Fri May 06, 2011 8:22 am   Post subject: RE:closing file stream during early program termination (matlab)

I don't know much about mat lab, but if it's event driven you could simply capture the end program command. Otherwise I don't see a way.
chopperdudes




PostPosted: Fri May 06, 2011 11:35 am   Post subject: RE:closing file stream during early program termination (matlab)

thx, but problem solved, there's apparently this function called onCleanup to do it for you. although onCleanup cannot be used on the script level only inside functions. just putting it here for future reference if anyone decides to search this forum for this topic.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: