0

Hello All!

I'm now creating a windows form application with login function. User need to input the id and password into two textbox. After clicking the "Login" button, the programme will compare the inputted id and password with a .txt file, if they match with each other, show a message.

Here is the text of the txt file("id" ; "password"):

james steve;123456abc
peter john;987ckja
nigel wood;456pwrd

I can only think of something like this:

#include<fstream>

private: System::Void login_Click(System::Object^  sender, System::EventArgs^  e) 

String ^ tbstr1 = idbox->Text;
String ^ tbstr2 = pwbox->Text;
char *name = (char*)Marshal::StringToHGlobalAnsi(tbstr1).ToPointer();
char *password = (char*)Marshal::StringToHGlobalAnsi(tbstr2).ToPointer();

ifstream fin (“login.txt”);
if (fin) { 
int count = 0;
while (!fin.eof()) { 
......;
fin.getline(id, 21, ';');
fin.getline(pw, 21, ';');
......;
fin.close();
}
2
Contributors
1
Reply
8
Views
2 Years
Discussion Span
Last Post by Moschops
0

This looks like some kind of Microsoft C++ variant. Managed C++, or some kind of C#, or some such. You might have more luck asking in that forum.

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.