Home > Net >  Is there a way to determine the file saved successfully executed immediately another way?
Is there a way to determine the file saved successfully executed immediately another way?

Time:09-30

Will write 20 files on the hard disk every second, and how to do it, as each file is written to the hard disk to save successfully executed immediately after another way? I want to save the file is compressed and delete

CodePudding user response:

Write file operations are asynchronous operation?
If is asynchronous operations and not the end of the Peugeot, can only be added delay processing,

CodePudding user response:

 
String path=@ "C: \ 1. TXT";
File. WriteAllText (path, "Hello");
If (the File. The Exists (path))
{
//execution method
}

CodePudding user response:

Await TaskA ()
Await TaskB ()

Or

Plieline
AddTask (A)
. AddTask (B)

Or

List nodelinke


Or
The Actor, the state machine

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

We have countless ways to do this, it need not entanglements, 17 years of every step you don't have to come over to ask, I believe you can get everything right, don't need to learn what blog garden want what is best, the best, also need not to come over to ask every write a word to drop this time there are several kinds of writing, you this question, even if is synchronous write two methods, he has a problem?

CodePudding user response:

We fear most and you don't write one line of code back word has several all day in there? The back word vs the word back,

You just write, implementation is the first,

I don't believe it, you can't write

Write file method ()
Method of compressed files ()
Delete the file ()

These three words, even if it is synchronous and????????? How??

CodePudding user response:

Want to see you save the file is made of other programs, or yourself to this program, program do yourself, just said above, or you want to go to monitor file

CodePudding user response:

The above is your own program writing files

If the application is listening to others, please change the grammar, "file to monitor" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- FileSystemWatcher

CodePudding user response:

Not feeling with asynchronous, I this is a second saved BMP images, you need to do to compressed JPG, because compression time is longer, sometimes in the compression process, state of the file is opened, judgment, open files, will line up
So I want to do is to save his success, the immediate execution

CodePudding user response:

Save the file should be synchronized as long as written documents save and close the write inflow without exception behind successful use them directly
  •  Tags:  
  • C #
  • Related