ok , here it all is... but first i will explain what it is meant to do.i will put it in startup when does, and i just want it to either run a prgram Teamspeak server and not KPF.... or run KPF and not Teamspeak.
my problem is now... when you put in more than 1 letter it outputs the error message accordingly to the amount of characters enterd... i tried to change that when i added the [1] in .... but that just makes it worse, if you enter more than 1 charcter it completly spams the error message.
also, it wont open the "C:/test.txt"
Code:
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
char yn[1];
cout<<"Do you wish to run TS server?.... enter Y or N\n"<<endl;
cin>>yn[1];
yn[1] = tolower (yn[1]);
if (yn[1] != 'y' && yn[1] != 'n')
{
do
{
cout<<"Error!, option was invalid, pleaee enetr Y or N\n"<<endl;
cout<<"Do you wish to run TS server?.... enter Y or N\n"<<endl;
cin.getline(yn, 1);
yn[1] = tolower (yn[1]);
}while (yn[1] != 'y' && yn[1] != 'n');
}
if (yn[1] == 'y')
{
cout<<"You chose too run TS server and not KPF"<<endl;
ifstream file("C:\\test.txt");
}
else if (yn[1] != 'y' && yn[1] == 'n')
{
cout<<"\nYou chose not to run TS and run KPF"<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}