hi there,
Currently im creating a login program. im using fstream to do this program, so i save my data in a text file. Im able to save data into the file, in the file you will see something like:
username:password:level
when i want to retreive the data from it, i will face a problem that:
Thx alot i have solve the problem. now i facing a new problem =P
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
cout << "Enter username to search for password: ";
cin >> search;
ifstream login;
login.open("filename");
getline(login,username,':');
getline(login,password,':');
getline(login,level,':');
while (username != search)
{
getline(login,username,':'); <== i have tried put a "cout << username;" and get the same value with my "search" but still continue looping.
getline(login,password,':');
getline(login,level,':');
}
login.close();
err i added cin.ignore(256); but when the program come to this part it will get nth,
it wont print New Username: and others. Just hang there but i can type smth @@
what do you mean by mixing >> and getline()
means that when i used getline() i can't use cin>> x; anymore ? ?
hi, its me again =)...
i have solve the problems and now i want to get a time for salting.
but all the website example are in printf( .... )
can show me how to get the time format?
Example 12:20:30(hh:mm:ss) i want to change it into format like this: 122030 just numbers ignore :
what i have tried is:
1 2 3
char times;
_strtime(times)
Saving << username << ":" << password << ":" << ("%h%m%s",times) << endl; <= this part is fstream i wan to save into text file.
with the code above i will get time format hh:mm:ss and still apear :
hope you understanding my problem...