I am newbie in C++ programming, I need to write a code to read a particular value from a file. for example if enter input as servername then it has to show ABCDE-1. I am trying with string function I am not able to get the results. Will anyone help in writing the logic.
File data
[ServerName]
ABCDE-1;
[DBLcation]
\\ABCDE-1\dat-520;
[ServerAPPsharename]
LR520APP;
[DerTablePath]
\\ABCDE-1\dat-520\CDM\derd;
[PTPWait]
9995;
In that first part is file data Thank you
to read the file data in string array.
string str;
string Database[10];
if (myfile.is_open())
{
int i=0;
while (myfile)
{
getline(myfile, str);
// here I am trying to store each word in array of string
//Database[i]=str;
i++;
}
}
else
{
cout << "Error in opening file\n";
}
to print the selected option.
cout<<"Enter what you want "<<endl;
cout<<"1.-ServerName \n2.-DBLcation \n3.-ServerAPPsharename \n4.-DerTablePath \n5.-PTPWait"<<endl;
I need write the code to print the value of selected option from file.
Aucun commentaire:
Enregistrer un commentaire