how can i be certain that a file has copied exactly?

Corey Chandler lists at sequestered.net
Sat Dec 27 01:31:05 UTC 2008


Gary Kline wrote:
> 	folks,
>
> 	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)
> 	fn?
>
> 	gary
>
>
>   
http://www.daemonology.net/bsdiff/ seems to maybe do what you want-- 
essentially diff should solve your problem, although I'm not too clear 
on how that works on differently compiled binaries.

I also seem to recall there was a test function that returned different 
results based on if the two files mentioned as arguments were identical, 
but I can't recall offhand quite what it was.

-- CJC


More information about the freebsd-questions mailing list