|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: May 2003
Città: Milky Way
Messaggi: 2332
|
[C++] fstream file binari
ciao raga vi espongo la questione:
fstream impFile( "Coda.dat", ios::out | ios::binary); streampos sp = impFile.tellg(); // Size of file numofelem = sp/sizeof(Trasportatore); impFile.seekp((numofelem) * sizeof(Trasportatore)); impFile.write(reinterpret_cast<const char *>( &nuovo ), sizeof(Trasportatore)); impFile.close(); file binario coda.dat e scrittura su file degli elementi della classe nuovo... il problema è che sovrascrive sempre lo stesso elemento nel file, non và avanti con la posizione successiva... forse il controllo sul numofelem non è giusto?
__________________
[1] MSI Z77A-G43 | Intel Core i7 3770 | RAM DDR3 16 GB | 2x(Samsung SSD 860 EVO 250Gb)+(ST1000DM010 1Tb) | LG GH24NSB0 + Samsung SH-224FB | Corsair CX430V2 | Wind3 FTTH 2,5 Gbps | Win 10 Pro x64 |
[2] HP Pavilion DV6-1345SL | P8700 | 8 Gb | 500GB 7200rpm | HD4650 1GB | 15,6" | Win 8.1 Pro x64 | |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: May 2003
Città: Milky Way
Messaggi: 2332
|
no answers?
suvvia!
__________________
[1] MSI Z77A-G43 | Intel Core i7 3770 | RAM DDR3 16 GB | 2x(Samsung SSD 860 EVO 250Gb)+(ST1000DM010 1Tb) | LG GH24NSB0 + Samsung SH-224FB | Corsair CX430V2 | Wind3 FTTH 2,5 Gbps | Win 10 Pro x64 |
[2] HP Pavilion DV6-1345SL | P8700 | 8 Gb | 500GB 7200rpm | HD4650 1GB | 15,6" | Win 8.1 Pro x64 | |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Feb 2006
Città: Banzi (Pz)
Messaggi: 657
|
nn son oun esperto ma credo ke dovresti fare un ciclo
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 09:53.



















