I need help with appending and retrieving information from the un() part of this program. I am trying to think of different ways to get information to and from a text file. If you could help I would be greatly appreciative. Thanks, kiknwing.
Code:
#include "stdafx.h"
class Index
{
ofstream myFile;
HANDLE np;
unsigned threadID;
char selection;
string user;
public :
Index(void);
~Index(void);
int m(void); //menu
void r(void); //register
void l(void); //login
void un (void); //username
void pw (void); //password
void notepad(void);
static unsigned int __stdcall notepadThread(void* arg);
void AI (void);
void c(void); //clearscreen
void p(void); //pause
} index;
int Index::m(void)
{
c();
cout<<"Register = 1\nLogin = 2"<<endl;
cin>>selection;
switch (selection)
{
case '1' : { AI();
break;
}
case '2' : { AI();
break;
}
default : { cout<<"nope";
break;
}
}
return 1;
}
void Index::AI(void)
{
if (selection == 1 || 2)
{
c();
cout<<"Please Enter Your Username."<<endl<<"Username: ";
cin>>user;
un();
}
}
Index::~Index (void)
{
}
void Index::un(void)
{
}
void Index::pw(void)
{
}
Index::Index (void) {
np = 0;
}
unsigned int __stdcall Index::notepadThread(void* arg) {
system("notepad.exe record.txt");
_endthreadex(0);
arg = 0;
return 0;
}
void Index::notepad(void) {
np = (HANDLE)_beginthreadex( NULL, 0, &Index::notepadThread, np, 0, &threadID );
}
void Index::c(void)
{
system("CLS");
}
void Index::p(void)
{
system("pause");
}
int _tmain(int argc, _TCHAR* argv[])
{
Index index;
while(index.m());
return 0;
}