06-19-2008 10:03 AM
06-19-2008 11:32 AM - edited 06-19-2008 11:32 AM
In my opinion you can't... the file handle is an identifier that is unique during program execution, but is dinamically cteated when you open the file depending on how much files are open at that moment (i.e. opening the same file in different moments can drive to different file handles if in the time elapsed you have opened / closed other files; similarly, the same file handle can refer to different physical files in different moments ).
One possible solution could be to receive from the caller both the file handle and its name, or to demand to the caller the responsibility of warning the operator of the failed search.
06-19-2008 05:05 PM
Well, actually I must partially correct myself: while I'm not aware of a method to obtain what you want from CVI file handles, I made a search on MSDN finding this thread that may be of some help to you.
According to that document, if you use SDK CreateFile function to open the file (and conseguently SDK functions to read / write to it ) you may derive the filename starting from the file handle. I made a simple project that uses the code supplied in that MSDN page to obtain the filename: take a lok at the attached project if you want to consider this way to solve your problem.