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.

9 Years
Discussion Span
Last Post by Ancient Dragon

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.