Would anyone be willing to provide me with some code to open a file and change some lines? We need to change a registry key on a hundreds of PCs and we're trying to automate it. We can export the key, delete the old key, and install the new key with command lines. Problem is we need to modify it.(eventually in a case statement because some will be different).
I can open a file and close a file. I know how to write to a file using fprintf. What I don't know how to do and haven't figured out, is how do I read lines from a file, and then modify a certain line? Once I could do that, I could just write it all to a new file that could be imported.
For example, the file is:
<start file>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_CONFIG\ImageBuild]
"Modified"="Release6 December 26, 2001"
<end file>
Needs to be changes to:
<start file>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_CONFIG\ImageBuild]
"Version"=dword:00000006
<end file>
I apologize that I'm not a c programmer. I've barely touched c since my college days. I mostly play around with Java, but I need this in C because our PC's do not have a JRE installed. I've tried finding some stuff on the net, but so far it's all too vague.
Any help is appreciated.
James
I can open a file and close a file. I know how to write to a file using fprintf. What I don't know how to do and haven't figured out, is how do I read lines from a file, and then modify a certain line? Once I could do that, I could just write it all to a new file that could be imported.
For example, the file is:
<start file>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_CONFIG\ImageBuild]
"Modified"="Release6 December 26, 2001"
<end file>
Needs to be changes to:
<start file>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_CONFIG\ImageBuild]
"Version"=dword:00000006
<end file>
I apologize that I'm not a c programmer. I've barely touched c since my college days. I mostly play around with Java, but I need this in C because our PC's do not have a JRE installed. I've tried finding some stuff on the net, but so far it's all too vague.
Any help is appreciated.
James