Writeprivateprofilestring() take delay to update original ini file
-
this makes absolutley no sense as to why this is happening... Here is the scenerio: I have an INI file that gets uploaded into some product durring the test. I have to modify the INI file before upload, so I do so using WritePrivateProfileString(x,x,x,x). Return value is good, no errors. Read the settings I just changed in the INI file via the GetPrivateProfileString(x,x,x,x), values returned match what I changed them to, ok, stop there.. (via breakpoint or messagebox) Now, go into windows explorer and open the INI file and none of the data in the INI file has changed per the write command. Now, exit the program, or stop it if in the enviornment. Now go and read the INI data from the INI file in windows explorer.. The data is now changed. Or you can simplely write some data to a bogus file and it will force the INI file to get updated... OK, now the reason this is such a problem is that after I modify the INI file I have to start the upload process, but I can't because the upload procss graps the file from windows, except the file hasn't been updated yet to the values I wrote using the writeprivateprofilestring command. This makes no sense to me. Why is windows waiting to update the actual file? Is the a command I need to send to force windows to release the cach so that the file gets updated? Hopefully someone can explaing what is going on here... Any information will help.. I hope I am so confused by this....
-
this makes absolutley no sense as to why this is happening... Here is the scenerio: I have an INI file that gets uploaded into some product durring the test. I have to modify the INI file before upload, so I do so using WritePrivateProfileString(x,x,x,x). Return value is good, no errors. Read the settings I just changed in the INI file via the GetPrivateProfileString(x,x,x,x), values returned match what I changed them to, ok, stop there.. (via breakpoint or messagebox) Now, go into windows explorer and open the INI file and none of the data in the INI file has changed per the write command. Now, exit the program, or stop it if in the enviornment. Now go and read the INI data from the INI file in windows explorer.. The data is now changed. Or you can simplely write some data to a bogus file and it will force the INI file to get updated... OK, now the reason this is such a problem is that after I modify the INI file I have to start the upload process, but I can't because the upload procss graps the file from windows, except the file hasn't been updated yet to the values I wrote using the writeprivateprofilestring command. This makes no sense to me. Why is windows waiting to update the actual file? Is the a command I need to send to force windows to release the cach so that the file gets updated? Hopefully someone can explaing what is going on here... Any information will help.. I hope I am so confused by this....
See the description here[^], particularly the paragraph that states: The system keeps a cached version of the most recent registry file mapping to improve performance. If all parameters are NULL, the function flushes the cache. While the system is editing the cached version of the file, processes that edit the file itself will use the original file until the cache has been cleared.
It's time for a new signature.
-
this makes absolutley no sense as to why this is happening... Here is the scenerio: I have an INI file that gets uploaded into some product durring the test. I have to modify the INI file before upload, so I do so using WritePrivateProfileString(x,x,x,x). Return value is good, no errors. Read the settings I just changed in the INI file via the GetPrivateProfileString(x,x,x,x), values returned match what I changed them to, ok, stop there.. (via breakpoint or messagebox) Now, go into windows explorer and open the INI file and none of the data in the INI file has changed per the write command. Now, exit the program, or stop it if in the enviornment. Now go and read the INI data from the INI file in windows explorer.. The data is now changed. Or you can simplely write some data to a bogus file and it will force the INI file to get updated... OK, now the reason this is such a problem is that after I modify the INI file I have to start the upload process, but I can't because the upload procss graps the file from windows, except the file hasn't been updated yet to the values I wrote using the writeprivateprofilestring command. This makes no sense to me. Why is windows waiting to update the actual file? Is the a command I need to send to force windows to release the cach so that the file gets updated? Hopefully someone can explaing what is going on here... Any information will help.. I hope I am so confused by this....
Sounds like a caching issue. Would it help to call
RegCloseKey()
when done writing?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius