I've searched the web for hours trying to find how to delete a file from the registry but havent found anything.

basically what I want to do is delete a file from a folder inside of the software folder of HKEY_CURRENT_USER for example

HKEY_CURRENT_USER -> Software -> MyProgram -> MySettings -> File

where 'File' is a binary file.

please help, I just want a simple code in C++ with an explanation on how to delete ONE file in the directory above.

Recommended Answers

All 2 Replies

1. Read the value at that registry setting. If you are using non-managed code (normal c++) then you can refer to any of these links for more information.

2. Assuming it is a path to a file, just use standard C function remove() to delete it.

3. You will also want to remove the path and filename from the registry entry to indicate it no longer exists. That prevents leaving orphaned entries in the registry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.