int main()
{
char* fileName = new char[50];
char* buf_name = new char[20];
char* buf_value = new char [10];
dyn_list vars; // Динамический список
cout << "Enter name of file -> ";
cin >> fileName;
ifstream* inp = new ifstream(fileName);
if (!inp->good())
{
cout << "File opening error!\n";
system("PAUSE");
return 0;
}
constr_list(vars);
while (!inp->eof())
{
inp->getline(buf_name, 20, ' ');
inp->getline(buf_value, 10, ' ');
comp_in(vars, buf_name, buf_value);
}
inp->close();
comp* p = new comp();
p = search(vars, "z");
if (p)
comp_del(vars, p);
p = search(vars, "abc");
if (p)
comp_edit(*p, "2");
ofstream* out = new ofstream(fileName);
while (vars.head != NULL)
{
out->write(vars.head->name, strlen(vars.head->name));
out->write(" ",1);
out->write(vars.head->value, strlen(vars.head->value));
out->write(" ",1);
vars.head = vars.head->next;
}
out->close();
system("PAUSE");
return 0;
}