How to save a bit on the physical disk in the C + +.
ofstream write only file, and I would like to save the hard bits but I do not know how to do it

You're still writing bits, even if you write a file.

Also, you can't just change one bit of a disk. The minimum addressable amount is typically 512 bytes (at the disk level).

The file system usually aggregates these into single units called clusters - who's size can be anything from 4K to 64K.

Now what are you really trying to do here?

how to write in C + + to save these bits on the disk because I do not know

I wrote such a thing but nothing happens

#include <windows.h>

int main()
    WCHAR disc_name[6];
    mbstowcs(disc_name, "\\.\D:", 6); nadpisac
    HANDLE h = CreateFile(disc_name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
    char data[512]; //bufor,
    memset(data, 1, 512);
    unsigned long count;
    WriteFile(h, data, 512, &count, NULL); 

Oh sorry, but as per my signature, your untagged code was being ignored.