This is a discussion on reading a file into a block within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by cyberfish For non-Linux/UNIX people, the dd program, in this case, copies big_file (a 100MB file with random ...
well this is all on the order of several KBs, I think it would be safe to say that there is negligible difference between something like 1MB and 1GB.
Perhaps. It's difficult to say, but I would agree that about 64K blocks is a good thing.
what I like is complete the exercise with the read(); it's not clear to me if I have to use memset to clean the memory or/and put the '\0' (anche in wich position).
I'm guessing that your '\0' ends up at the wrong place (too late), so you get some garbage.
The easiest way is, of course, memset.