I know that in stdio.h there is a function 'fread()' for reading a number of bytes from a file directly into an array. Are there any other ways of moving lots of data, especially any ways inherent to the language, and not held in libraries?
Specifically what I want is a fast, tidy solution to having a large array that can be reset any time, and whose initial value is essentially particular at every index.
Otherwise I'll probably end up creating a temp file.
I have an array. And it's starting value is specific, i.e. not all 0's or '\0's or anything, but a certain pattern. At intervals I need to reset it to this initial value.
I know that I could write the whole array to a file, and use fread() to transfer the data from that file to my array, but I would prefer a method that doesn't use files, but just another block of RAM.
The first simple solution would be to loop through, element by element, copying them from one to the other, but my array is of char's, so this would be extremely slow. I could conceivably copy four of them at a time with proper casting, given processors' word length of 4 bytes, but I suspect there may be an even speedier solution or trick.