Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: INI files IniWritePvt
I am basically trying to edit the *headers* in an INI file, without recreating them anew. For speed and just plain old practice, I decided to use the binary functions to search and replace. Based on one changed variable, however, I need to change several different headers. Therefore, I call my search and replace function 2 or 3 times to operate on a single file.
My problem seems to be: if I run my program and do the replace, I get different results for the same input. However, if I have the debug(@on) in my program near my possibly offending code, even if I immediately hit the RUN button, the code works every time I have tried it. My best guess so far is that the Write hasn't taken place before the next read occurs - but I have inserted 10 second delays, and gotten almost identical results. (w/debug it works, w/o debug it sometimes works, or does one set of replaces) I'd like to stick to the binary s&r if I can,though I'd consider switching to FileRead /write if I had to.
Try adding:
IniWritePvt("","","","yourinifilename.ini")to the top of the script to force a "flush" of any cached copies to disk. The three null parameters is a hint to windows to flush it out of cache.
BinaryWrite(xx,"file1.txt")(then file2.txt file3.txt, etc)
so you can see the step by step progress of your changes. And see if some disappear or something.
Article ID: W12739
Filename: Use Binary Functions to Edit INI Files.txt
File Created: 1999:04:15:16:49:18
Last Updated: 1999:04:15:16:49:18