Click here to Skip to main content
15,887,302 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
If I "kill" the file will be saved automatically?
Process open = new Process();
                    open.StartInfo.FileName = @"C:\Users\newText.txt";

                    open.Kill();

I know, I can try but I couldn't find it anywhere on the internet and some people will be more happy with faster answer.

What I have tried:

C#
Process open = new Process();
                    open.StartInfo.FileName = @"C:\Users\newText.txt";

                    open.Kill();
Posted
Updated 25-Sep-20 0:42am
Comments
Richard MacCutchan 25-Sep-20 6:39am    
What happens when you try it?
dejf111 25-Sep-20 7:04am    
until now I find out that nothing :D
Richard MacCutchan 25-Sep-20 7:21am    
What did you exoect?
dejf111 25-Sep-20 7:26am    
file opening and closing

1 solution

No. Kill does just that: terminates the thread with extreme prejudice.
It doesn't give it a chance to "tidy up" or "put it's affairs in order" - it kills it right here, right now.

It's like a sniper rifle: the victim drops where he stands, he doesn't finish his coffee, fold up the paper and settle the cafe bill first.
 
Share this answer
 
Comments
dejf111 25-Sep-20 6:48am    
Nice answer :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900