[C++] Carattere 26

di Anonimizzato8480 il
3 risposte
Oggi ho notato che se provo a leggere da file il carattere 26 (?) usando file.read(), il carattere non viene letto; capita così anche a voi?

Attendo risposte.
        c[0] = 26;
        d[0] = 1;

        ofFile.open(cPathFile, fstream::out);
        ofFile.write(c, 1);
        ofFile.close();

        ifFile.open(cPathFile, fstream::in);
        ifFile.read(d, 1);
        ifFile.close();

        cout << (int)c[0] << " -> " << (int)d[0] << ", " << c[0] << " -> " << d[0] << endl; // d[0] rimane 1

3 Risposte

  • Per un file aperto in modalità testo il 26 è il carattere speciale EOF che indica, appunto, la fine del file.
  • oregon ha scritto:


    Per un file aperto in modalità testo il 26 è il carattere speciale EOF che indica, appunto, la fine del file.
    Ah, non lo sapevo. Grazie
Devi accedere o registrarti per scrivere nel forum
3 risposte