Helpful Information
 
 
Category: C Programming
C++ Registry Editing and file writing

I need the script fragment which gives the command to write a file. Also, please show where to insert the information to write and how to make it so that it writes the text in a text file. Also, how do I edit registry files using the C++ console programming. Is there a tutorial which explains on writing files and registry editing.

Well?

Depends on your programming environment. If you're using C++ Builder, then you could use a TRegistry() object which encapsulates registry calls. If you are using Visual C++ or you just want to use the windows api, you could use the functions such as RegOpenKey(), RegSaveKey() etc. You could start here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/regapi_9bzt.asp) for an overview of the functions.

As for writing to a file, consult any C++ book.

I am using the BloodShed C++ compiler. I don't own any C++ books. I am programming the DOS Console programs.

Oh, and how about some actual help instead of redirecting me a windows page? I already know how to manually edit the regestry and about .reg files.

How about showing some initiative instead of expecting others to do your work? How about some courtesy for those that are trying to help you? Sheesh...

In the mean time, look up the following functions at the site Scorpions directed you to:

open(...)
read(...)
write(...)
close(...)
memcpy(...)
memset(...)
fopen(...)
fclose(...)
fprintf(...)

(Win32-specific functions)
CreateFile(...)
ReadFile(...)
WriteFile(...)
CloseHandle(...)
DeleteFile(...)

You may or may not need all of those functions, depending on what you want to do.

As far as using the registry goes, did you even try searching Google for "Registry"? Anyhow, go here and look at the tutorials under the section entitled "Registry."

http://www.codeproject.com/system/

I'm not sure if these will compile with your compiler. You may need to fork out the cash for VC6 or VS.NET if you want to be able to use these features. There may also be freeware Win32 compilers available, but I have never sought nor used them.

HTH,

there is no registry access in DOS... do you mean console application for win32???

you really should spend the money for at least 1 book on windows c++ programming... or you will just fail again and again :(


jonsagara, do you want him to read the binaries of the registry? he does not know anything about c / c++, so why should he be able to do this?
(not flaming you, but Battery_Acid!!!)

Originally posted by Battery_Acid
Oh, and how about some actual help instead of redirecting me a windows page? I already know how to manually edit the regestry and about .reg files.

If you look at the page for the link I posted above, there's a link in that page to the Registry Reference which lists all the Registry functions like RegOpenKey(), RegCloseKey() etc. If you read the documentation for any of those functions, there's a link to sample code in there as well.

BTW, these functions should work on C compiler for Windows, because they're using the Windows API, not any compiler specific class librarires. I'm not familiar with the BloodShed C++ compiler, but if it compiles binaries for Windows, the functions should work just fine in there as well.

Well speaking about bloodshed dev c++ if the program doesnt compile you might consider downloading a header file to the include directory. For example when I was working with the java native interface and needed to include jni.h and the computer generated jni stub made by the java interpreter I searched google for the jni.h and got the file. There are also many others if your compiler doesnt have that header.

bye
George

I must say I agree with the courtsey/respect that should be shown to our experts. They do it not because they have to but because they enjoy it. Respect and initiative will get you a long way!










privacy (GDPR)