[FoLUG]Recupero file da CD (e 2 ...)
PalmaWay
folug@lists.linux.it
Mon, 17 Mar 2003 19:55:48 +0100
This is a multi-part message in MIME format.
--=====000_Dragon734486160846_=====
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 8bit
Anzitutto grazie a chi aveva risposto alla mail di qualche giorno fa con cui chiedevo aiuto per recuperare dati da un file su un CD impossibile da leggere nei byte iniziali.
Ho (quasi...) risolto il problema scrivendo un programma in C che copia un file partendo dai byte finali, creando un file di dimensioni identiche a quelle del file d'origine in cui i byte eventualmente non letti rimangono a NULL.
Visto che il programma può essere di utilità per qualcuno allego il sorgente (neanche 3 Kb).
Per farlo funzionare è necessario modificare il sorgente (impostando i file da copiare ed il num di byte) e compilarlo, lo so, non è bello ma il tempo è quello che è ...
Spero che sia utile per qualcuno!
Ciao a tutti
Paolo Palmieri
P.S. Il programma si chiama Reverse Copy (o rc) ed ovviamente è sotto GPL!
--=====000_Dragon734486160846_=====
Content-Type: application/octet-stream;
name="rc.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="rc.c"
LyogUmV2ZXJzZSBDb3B5IC0gdmVycy4gMS4wIC0gMjAwMyBQYW9sbyBQYWxtaWVyaSAocGFsbWF3
YXlAZ214Lml0KQogKiBDb3BpYSB1biBmaWxlIHBhcnRlbmRvIGRhaSBieXRlIGZpbmFsaS4KICog
TW9kaWZpY2FyZSBpIHNvcmdlbnRpIHBlciBsJ3Vzby4KICogLSAtIC0gLSAtCiAqIFRoaXMgcHJv
Z3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9k
aWZ5CiAqIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vu
c2UgYXMgcHVibGlzaGVkIGJ5CiAqIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhl
ciB2ZXJzaW9u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