• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Other application opening a file

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
Is there a way , with the help of which we can determine , whether any other application have opened the file or not.

For Ex:
If I give path to a txt file , and if have used notepad , to open that file , the function should return false , and as I close that file , the function in that case , should return true.


I got one method ,
if we try to rename the file....or try to set to set last modified time.....and if its really opened by some application ..........it won't allow me to rename it or change the time
but the problem occurred with *.txt file.
If I open a txt file with a notepad , after opening the file , I can even delete the file or rename the file.
So what to do in such case.

-Gaurav
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

There's probably no general solution. Some applications may keep the file open while they show it in the GUI; others (such as Notepad, apparently) just read it, but don't keep it open.
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic