If it is being displayed in an edit control you can use ES_PASSWORD for creating the control. Otherwise you'll need to intercept calls to write to the control and DIY.
I don't think you can do that. If your file has "******" saved in it, then you wont be able to ever get "153634" back.
Which isn't to say you can't "hide" the data by making it not human readable.
Easiest method I can think:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <fstream>
usingnamespace std;
int main(){
ofstream outFile;
int data = 1234;
outFile.open("output.txt", ios::out | ios::binary);
outFile.write((char*)&data, sizeof(data));
outFile.close();
cout << "\nDONE. Hit ENTER to quit."; cin.get();
return 0;
}
Now if you open the file in NotePad it will look like this: "Ӓ "
(It's actually less legible in NotePad).
You can still retrieve the data:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <fstream>
usingnamespace std;
int main(){
ifstream inFile;
int data
inFile.open("output.txt", ios::in | ios::binary);
inFile.read((char*)&data, sizeof(data));
cout << data;
inFile.close();
cout << "\nDONE. Hit ENTER to quit."; cin.get();
return 0;
}
Or you could simply do some math on your number so that what gets written into the file isn't really what the number is. Then you can remember what math you did and reverse it when reading from the file.