how can i be certain that a file has copied exactly?
freebsd-questions-local at be-well.ilk.org
Sat Dec 27 01:32:55 UTC 2008
Gary Kline <kline at thought.org> writes:
> is there a way i can be sure that my little C program has copied a
> dos/win file named, say, foo.htm\;7 to simply foo.htm?
> my program uses fopen/fgets/fputs to copy the markup files. of
> the several i have copied, no problem. unless i hack cmp or diff,
> i have to avoid the shell.
> any ideas? in other words, does anybody have a prefab cmp(oldfile, newfile)
mtree(1) handles whole ranges of files.
For a single file, you could use some kind of checksum in your program
or externally, but in general it will be comparing against the cache of
the file's buffers, not against what is really on disk, so if you
suspect an operating system or hardware-write bug, you won't spot it
What, precisely, would you like to protect against?
Lowell Gilbert, embedded/networking software engineer, Boston area
More information about the freebsd-questions