Input txt file:
La mia casa si trova in Calabria ed e' esattamente a Cosenza. Questo file sarà analizzato in una modalità
binaria attraverso l'importazione dei dati in quest'ultimo formato.
Output txt file:
La mia casa si trova in Calabria ed e' esattamente a Cosenza. Questo file sarà analizzato in una modalità
binaria attraverso l'importazione dei dati in quest'ultimo format
An int is probably 4 bytes (it usually is) which means your program is reading and writing data in chunks of 4 bytes.
When the only thing left to be read from the file is "to." the read operation will fail because you are trying to read 4 bytes but there are only 3 bytes, so "to." is never added to the vector.
I thought something like that but I was not sure because I am dealing with binary I/O from few time.. In a real situation like that how could this problem be handled? Thanks!
Note that I use gcount after loop to check if there and how many symbols read before eventual failure. You might use it to adapt your original program (however I have no ide what you would do with missing bytes)