How to write a large buffer into a binary file in C++, fast?

I’m trying to write huge amounts of data onto my SSD(solid state drive). And by huge amounts I mean 80GB. I browsed the web for solutions, but the best I came up with was this: #include <fstream> const unsigned long long size = 64ULL*1024ULL*1024ULL; unsigned long long a[size]; int main() { std::fstream myfile; myfile = … Read more

Unicode (UTF-8) reading and writing to files in Python

I’m having some brain failure in understanding reading and writing text to a file (Python 2.4). # The string, which has an a-acute in it. ss = u’Capit\xe1n’ ss8 = ss.encode(‘utf8′) repr(ss), repr(ss8) (“u’Capit\xe1n’”, “‘Capit\xc3\xa1n’”) print ss, ss8 print >> open(‘f1′,’w’), ss8 >>> file(‘f1’).read() ‘Capit\xc3\xa1n\n’ So I type in Capit\xc3\xa1n into my favorite editor, in … Read more

Cannot delete directory with Directory.Delete(path, true)

I’m using .NET 3.5, trying to recursively delete a directory using: Directory.Delete(myPath, true); My understanding is that this should throw if files are in use or there is a permissions problem, but otherwise it should delete the directory and all of its contents. However, I occasionally get this: System.IO.IOException: The directory is not empty. at … Read more