I need to make a number of large text files of varying sizes, in exact multiples of megabytes (in other words, exactly 10 MB, 50 MB, 100 MB, and I'm not sure how big I'll have to go).
I don't want the files to be all ones or zeroes, so I have a text file of about 10 MB, and I want to copy that text as many times as needed to make my files.
I have seen advice to use sendfile instead of read() and write(). I wrote something that will make a 1MB file from my 10MB file, but I wonder how I can loop around once I hit EOF to make a file of more than 10MB.
This will ultimately be used on a Linux computer but I'm writing it now in Cygwin (Windows) in C.