Q:

c++ read doesn't work

code l6.h
#include <string>
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;

struct data
{
    int mt;                 //metai
    int men;                    //menesis
    int die;                    //diena
};

struct sarasas                  //sakos
{
    int pg;                     //pagamintas kiekis
    int ka;                     //kaina
    data dt;                    //data

};

struct SarV
{
    sarasas duom;
    SarV *sekV;
};

class Detale
{
private:
    SarV *p, *d;                                //saraso padzia
public:
    Detale():p(NULL) {}
    ~Detale() {};                       //destruktoriuis
    void Pradzia(){d = p;}
    bool Pabaiga(){return d == NULL;}
    void Kitas(){d = d->sekV;}
    void Imti(sarasas &st){ st = d->duom;}
    void Papildyti(sarasas st ){
        SarV *d = new SarV;                 //saka papildoma nauju elementu
                    d->duom = st;
                    d->sekV = p;
                    p = d;
                                }
};

l61.h file
#include <string>
#include <fstream>
#include <iostream>
#include <iomanip>
#include "l6.h"

using namespace std;

struct kamienas
{
    string deta;                //Kamieno detale
    Detale sar;             //sakos padzios rodykle
    kamienas *kitas;
};

class Sak
{
private:
    kamienas *pr;               //saraso pradzia
    void SpausdintiSaka(ofstream &fr, Detale &sar);
public:
    Sak() {pr =NULL;}
    ~Sak();
    void Skaityti(ifstream &fd);
    void Spausdinti(string fv);
};

l61.cpp file
#include "L61.h"

Sak::~Sak(){}

void Sak::Skaityti(ifstream &fd)
{
    string dt,eil; char pabaiga[30];// int kiekis, kaina, metai, menuo, diena;                          //detalei saugoti
    bool baigti= false;
    getline(fd, dt);                            //skaitomas detales pavadinimas
    fd.ignore(80, '/n');
    kamienas *d = new kamienas;                 //naujas saraso elementas
    d->deta = dt;
    d->kitas = pr;
    pr = d;
    while (!baigti)                             //skaitomaas vienas dokumentas
    {   
        fd.get(pabaiga, 15);
        eil=pabaiga;
        if(eil == "***")
        {
            baigti = true;
        }
        else
        {
            sarasas st;
            fd >> st.pg>> st.ka >> st.dt.mt >> st.dt.men >> st.dt.die;
            pr->sar.Papildyti(st);
        }
        fd.ignore(80, '\n');
    }
} 

void Sak::Spausdinti(string fv)
{
    ofstream fr(fv.c_str(), ios::app);
    for (kamienas *d = pr; d != NULL; d = d->kitas) 
    {
        fr << "Detale: " << d->deta<< endl;
        SpausdintiSaka(fr, d->sar);
    }
}
void Sak::SpausdintiSaka(ofstream &fr, Detale &sar)
{
    sarasas d;
    for(sar.Pradzia(); !sar.Pabaiga(); sar.Kitas())
    {
        sar.Imti(d);
        fr << d.pg << "vnt. " << d.ka << "Lt  " << d.dt.mt<<" "<<d.dt.men<<" "<<d.dt.die<<" data"<<endl;
    }
    fr<<"-------------------------\n";
}

and main()
#include <string>
#include <fstream>
#include <iostream>
#include "L61.h"

using namespace std;
const string CDfv = "duomenys.txt";
const string CRfv = "rezultatai.txt";
void IvestiDokumentuDuomenis(Sak &sakotas,string fv);
int main()
{
    ofstream fr(CRfv.c_str());
    fr.close();
    Sak s;                          //objektas su sakotu sarasu
    IvestiDokumentuDuomenis(s,CDfv);
    s.Spausdinti(CRfv);
    return 0;

}

void IvestiDokumentuDuomenis(Sak &sakotas,string fv)
{
  ifstream fd(fv.c_str());
  int n = 1;
  while (!fd.eof()) {
      sakotas.Skaityti(fd);
    cout << "Perskaitytas " << n <<"-asis dokumentas\n";
    n++;
  }
  fd.close();
}

I want to get the first line of duomenys.txt file: "varztas", but if I do this with these lines in l61.cpp:
getline(fd, dt);            
fd.ignore(80, '/n'); 

my program doesn't work, but if I comment this line, program works, but doesn't write title of "varztas".
duomenys.txt file looks like
Varztas 
30 200 2000 01 03
***

So I need that Varztas will put in mass.
Sorry for my English.

A:

You wrote '/n' instead of '\n' in this line:
fd.ignore(80, '/n');

Since the value corresponding to the multicharacter literal '/n' won't be found, this will cause 80 characters to be skipped from the stream.

