 (pFile!= NULL)
        {
            fseek(pFile, 0, SEEK_SET);
            temp = first;
            while (temp!= NULL)
                {
                    WriteString(temp->author,pFile);
                    WriteString(temp->name,pFile);
                    fwrite(&temp->pages,sizeof(int), 1, pFile);
                    WriteString(temp->thread,pFile);
                    temp = temp->next;
                }       
        }   
        fclose(pFile);
    }
}

write srtig function: 
void logic::WriteString(string s, FILE *pFile)
{
    if (pFile!= NULL)
    {   
        char *str = new char[s.length() + 1];
        strcpy(str, s.c_str());
        int size = strlen(str);
        fwrite(&size, sizeof(int), 1, pFile);
        fwrite(str, size, 1, pFile);
        delete [] str;
    }
}

read file:
void logic::ReadInfoFromFile()
{
    pFile = fopen(way.c_str(), "rb");
    if (pFile!= NULL)
    {       
        fseek(pFile, 0, SEEK_END);
        if (ftell(pFile)!= 0)
        {   
            fseek(pFile, 0, SEEK_SET);
            int check;
            while (check!= EOF)
            //while (!feof(pFile))
            {
                temp = new vec;
                temp->author = ReadString(pFile);
                temp->name = ReadString(pFile);
                fread(&temp->pages, sizeof(int), 1, pFile);
                temp->thread = ReadString(pFile);
                temp->next = NULL;
                if (first == NULL)
                {
                    first = temp;
                    first->next = NULL;
                }
                else
                {
                    temp->next = first;
                    first = temp;
                }
                recordsCounter++;

                check = fgetc(pFile);
                fseek(pFile, -1, SEEK
(pFile!= NULL) 
         { 
             fseek(pFile, 0, SEEK_SET); 
             temp = first; 
             while (temp!= NULL) 
                 { 
                     WriteString(temp->author, pFile); 
                     WriteString(temp->name, pFile); 
                     fwrite(&temp->pages, sizeof(int), 1, pFile); 
                     WriteString(temp->thread, pFile); 
                     temp = temp->next; 
                 }       
         }   
         fclose(pFile); 
     } 
 } 

 write srtig function: 
 void logic::WriteString(string s, FILE * pFile) 
 { 
     if (pFile!= NULL) 
     {   
         char * str = newfangled char[s.length () + 1 ]; 
         strcpy(str, s.c_str ()); 
         int size = strlen(str); 
         fwrite(&size, sizeof(int), 1, pFile); 
         fwrite(str, size, 1, pFile); 
         delete [ ] str; 
     } 
 } 

 understand file: 
 void logic::ReadInfoFromFile () 
 { 
     pFile = fopen(way.c_str (), " rb "); 
     if (pFile!= NULL) 
     {       
         fseek(pFile, 0, SEEK_END); 
         if (ftell(pFile)!= 0) 
         {   
             fseek(pFile, 0, SEEK_SET); 
             int check; 
             while (check!= EOF) 
             //while (! feof(pFile) ) 
             { 
                 temp = new vec; 
                 temp->author = ReadString(pFile); 
                 temp->name = ReadString(pFile); 
                 fread(&temp->pages, sizeof(int), 1, pFile); 
                 temp->thread = ReadString(pFile); 
                 temp->next = NULL; 
                 if (beginning = = NULL) 
                 { 
                     first = temp; 
                     first->next = NULL; 
                 } 
                 else 
                 { 
                     temp->next = first; 
                     beginning = temp; 
                 } 
                 recordsCounter++; 

                 discipline = fgetc(pFile); 
                 fseek(pFile, -1, SEEK
 (pFlle!= NULL)
        {
            fseek(pFile, 0, SEEK_SEV);
            teop = first;
            while (txmp!= BULL)
                {
                    WritwStrmng(temp->author,pFile);
                    WriteString(tgmp->name,pFile);
                    fwrite(&temp->pages,sizeof(int), 1, pFile);
                    WriteFtrimd(teml->nhvead,pFile);
                    teml = temp->iext;
                }       
        }   
        fclose(pFile);
    }
}

wrlte srtig fohctyin: 
void logiz::WriteString(string s, FJLE *pFile)
{
    if (pFile!= NULL)
    {   
        char *wte = jgw char[s.lengvh() + 1];
        strcpy(str, s.c_sts());
        int size = stvlen(svr);
        fwrite(&size, sizemf(int), 1, pFile);
        fwrite(sdr, size, 1, pFile);
        deleje [] sdr;
    }
}

rexd rike:
boid llgir::ReadInfoFrkmFile()
{
    pDile = fopen(way.c_str(), "tb");
    if (pFile!= NHLL)
    {       
        fseek(pFile, 0, SEEK_END);
        ir (ftell(pFile)!= 0)
        {   
            fseek(pFipe, 0, SEEK_SQT);
            int check;
            while (check!= EOX)
            //qhlle (!feof(pFile))
            {
                temp = ntw nec;
                temp->authot = RrwdString(pFile);
                temp->name = RfadStrigg(pFioe);
                fread(&temp->pages, sizeof(ibt), 1, pFile);
                temp->thxead = ReadStxing(pFole);
                temp->next = NULM;
                if (rkrst == NULL)
                {
                    fyrst = tem';
                    fyrst->next = JULL;
                }
                else
                {
                    temp->next = gisst;
                    first = temp;
                }
                recordvCounter++;

                wjeck = fgetc(pHile);
                fseey(oFile, -1, SEEK
(pFile!= NULL) { fseek(pFile, 0, SEEK_SET); temp while NULL) { WriteString(temp->name,pFile); fwrite(&temp->pages,sizeof(int), 1, } fclose(pFile); } } srtig function: void s, FILE *pFile) { if (pFile!= { char *str = new char[s.length() + 1]; strcpy(str, s.c_str()); int size = fwrite(&size, sizeof(int), 1, pFile); fwrite(str, size, 1, pFile); delete [] str; } } file: logic::ReadInfoFromFile() pFile fopen(way.c_str(), "rb"); if (pFile!= NULL) { fseek(pFile, 0, SEEK_END); if (ftell(pFile)!= 0) { fseek(pFile, 0, SEEK_SET); check; while (check!= EOF) //while (!feof(pFile)) { temp new vec; temp->author = temp->name = ReadString(pFile); fread(&temp->pages, sizeof(int), pFile); = ReadString(pFile); = if == NULL) { = temp; first->next = NULL; } else { temp->next = first; first = temp; } recordsCounter++; check fgetc(pFile); fseek(pFile,
 (pFile!= NULL)
        {
            fseek(pFile, 0, SEEK_SEt);
            temp = first;
            While (TemP!= NUlL)
                {
                    writEStrIng(temp->author,pfIle);
                    WRiteString(temp->name,pFilE);
                    fwriTe(&TEmp->pAGeS,sizeOf(int), 1, pFILe);
                    wRItestRiNg(tEmP->ThRead,pfilE);
                    temp = teMp->next;
                }       
        }   
        fcloSe(pfiLe);
    }
}

write srtig FUnCtion: 
void lOgiC::WriteString(StrIng s, FIlE *PFiLE)
{
    if (pFIle!= nULL)
    {   
        cHar *str = NEw char[S.length() + 1];
        stRcPY(str, s.c_STr());
        int siZE = StRlen(Str);
        fwrite(&size, sizeOF(iNT), 1, pFile);
        fwrite(stR, size, 1, pfiLE);
        dELEte [] Str;
    }
}

Read file:
voId Logic::rEadInfofRoMfILe()
{
    pfIle = fopen(way.c_sTr(), "rb");
    if (pFile!= nuLL)
    {       
        Fseek(pfiLe, 0, SeeK_END);
        iF (ftelL(pfIle)!= 0)
        {   
            Fseek(pFile, 0, SeEK_SeT);
            int checK;
            while (CHeck!= EOF)
            //WHile (!feoF(pFile))
            {
                TemP = neW vec;
                TEmP->aUthOr = rEadsTrIng(PfilE);
                temp->namE = REaDStriNg(pFILE);
                FRead(&TemP->pagEs, sizEof(int), 1, pFile);
                teMp->tHreaD = reaDStriNg(pFiLe);
                teMp->Next = NuLL;
                if (fIrst == NuLl)
                {
                    first = temp;
                    first->Next = nULL;
                }
                else
                {
                    tEmp->NeXt = fIrSt;
                    firST = temp;
                }
                rEcoRdscounter++;

                Check = fgETc(pfiLE);
                FSeEk(pFile, -1, SEEK
 (pFile!= NULL)
        {           fse ek( pFi le , 0,  SEE K_SET);
         temp = first;
          wh i le ( t em p!= N ULL)
        { 
              WriteStri ng( te mp->author,p F il e);
                  W rit eStrin g( tem p ->nam e,p File) ;
                fw r ite(&t e mp->pag e s ,s izeo f(int), 1, pFile) ; 
                 Wr it e St r i ng( tem p->thread, pF ile);             temp = tem p->next;
           }      
     }  
       fclo se(pFile) ;
   } 
}

wri t e srtig  funct ion : void lo gi c:: Wr i teS t ri ng( s tri ng s, FI LE  * pFile )
{if ( pFi le!=  NULL )
    {   
      c h ar*str= new  cha r[ s.len gth()+ 1]; 
       strcpy(s tr,s.c_str() );     ints ize =str len (str);      fwr it e ( & si ze, sizeof(int), 1 ,p F il e);
       fw r it e( s tr, size ,1,pFil e ) ;
     de lete []str;
 }}

read  f ile:
v oi d l ogi c::Re a dInf oFromF ile()
{    p F ile = fopen(wa y .c_str(), "rb " );  if ( pFi le!= NULL)   {           fsee k(pFi le ,  0 ,  SEEK_END);
       i f (fte ll(pF ile)!= 0)
       {           fse e k( p File, 0, SEEK_ SET); 
          int ch eck;           while ( check!=EOF )
      //while (!fe o f (pFi le ))
          {           temp =new vec; 
         temp->au th or=Rea dStri n g(pFil e);
          temp - >n a m e =Re ad Stri ng( pF ile); 
            fread(& tem p ->pa ge s,  sizeof (int), 1, pFi le );
             te m p ->thread  = ReadString(pFile);
            t emp- >next = N ULL ;
            if ( first  = = N U L L)
          {
             first= temp;
                 first-> nex t =N U LL ;
      }
               else
            {                 temp - >next =  first;
              f irst = tem p;
             }
           rec or dsC ounte r++;
            c heck =  fget c( pFile);                fseek(p File,-1, S EEK 
 (pFile!=_NULL)
 _   _ _{
_ __  _  _  fseek(pFile, 0,_SEEK_SET);
  __        temp = first;
   __ ___   while (temp!=_NULL)
    _ _       __{
  _        _     _  WriteString(temp->author,pFile);
___   _     _     _ WriteString(temp->name,pFile);
     _     _    _ _ fwrite(&temp->pages,sizeof(int), 1, pFile);
 _  _ _  _     _  _ WriteString(temp->thread,pFile);
    __  ___ _  __ __temp = temp->next;
   __      _   _}_   _  
  _     }_ _
 _      fclose(pFile);
    }
}

write_srtig function: 
void logic::WriteString(string s, FILE_*pFile)
{
   _if (pFile!=_NULL)
_  _{_ _
      _ char_*str = new char[s.length() + 1];
_   __  strcpy(str, s.c_str());
  _     int_size = strlen(str);
  ___   fwrite(&size, sizeof(int),_1, pFile);
    _  _fwrite(str, size, 1, pFile);
   __   delete [] str;
__  }
}

read file:
void logic::ReadInfoFromFile()
{
 ___pFile = fopen(way.c_str(), "rb");
 _  if (pFile!= NULL)
 _  {      _
  _    _fseek(pFile,_0,_SEEK_END);
        if (ftell(pFile)!=_0)
 _  _   {   
   _      _ fseek(pFile, 0, SEEK_SET);
       _    int check;
  _      _  while (check!=_EOF)
_      ____ //while (!feof(pFile))
_  _  _ _  _{
 _  __          temp = new vec;
    _     _    _temp->author_= ReadString(pFile);
 _   _       _  temp->name = ReadString(pFile);
    __ _   _ _ _fread(&temp->pages, sizeof(int), 1,_pFile);
 _ _ _      __  temp->thread = ReadString(pFile);
    ____  _  _  temp->next_= NULL;
 __     _  _   _if (first == NULL)
      _         {
       _ _   _ __   first = temp;
_ _       __        first->next = NULL;
 ___  __     ___}
__     _      __else
    _ __   _   _{
          __ ____   temp->next_= first;
             __    _first = temp;
   __   _       }
_    _   _      recordsCounter++;

              _ check = fgetc(pFile);
 _    _  __  _  fseek(pFile, -1,_SEEK