Update a file if this is needed.
b = helptbx_updtifneeded ( content , filename )
a 1-by-1 matrix of strings, the new content
a 1-by-1 matrix of strings, the file to be checked.
a 1-by-1 matrix of booleans
Returns true if the filename is up-to-date, that is,
if the file was not changed.
Returns false if the file was changed.
The file is to be updated according to the rules of the
helptbx_iscontentupdte function.
Generates an error if the file was to be changed, but that was not possible.
// Create a sample file. content = "Coucou!"; filename = fullfile(TMPDIR,"test.txt"); // Update the file. b = helptbx_updtifneeded ( content , filename ) // Expected=%f // See the content of the file. content2 = mgetl ( filename ) and(content==content2) // Expected=%t // No update is necessary now. b = helptbx_updtifneeded ( content , filename ) // Expected=%t // Change the content content = "Hello!"; b = helptbx_updtifneeded ( content , filename ) // Expected=%f // See the content of the file. content2 = mgetl ( filename ) and(content==content2) // Expected=%t // No update is necessary now. b = helptbx_updtifneeded ( content , filename ) // Expected=%t // Delete the file mdelete(filename); | ![]() | ![]() |