id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	guest	host
1187	Cannot write more than 1023 bytes at once on shared drive via C++ ofstream => Fixed in SVN	farin		I have a strange behaviour when writing files to shared folders on the host system.\r\nThe configuration is:\r\nhost: Windows-XP\r\nguest: Linux, Debian, 2.6.22 (lenny / testing)\r\ngcc on guest: 4.2.3\r\n\r\nWhen using this simple test program, compiled on the guest linux system:\r\n---------------\r\n#include <iostream>\r\n#include <iomanip>\r\n#include <fstream>\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n  char buf[5000];\r\n\r\n  for (int i=0;i<5000;i++) buf[i]=1;\r\n\r\n  std::ofstream os("out", std::ios::binary | std::ios::out);\r\n  os.write(buf, 1024);\r\n\r\n  os << "end" << std::endl;\r\n}\r\n---------------\r\n\r\nThe program writes only 'zeros' instead of 'ones' when the output is a shared\r\nhost folder (ntfs, mount options: "rw,exec,suid,dev"). This happens when the number\r\nof bytes written is >=1024. For chunks smaller than 1023, it works ok. It also\r\nworks ok, if the output is on the guest file-system.\r\n\r\nIf the last line is removed (the file output is not flushed), no output is written\r\nat all (zero-length file). The ios::bad flag is not set after writing, claiming\r\nthat everything went ok.\r\n\r\nReplacing the ofstream output with fwrite-based code works ok for all sizes.\r\n\r\nNot sure, if this is a stdc++ problem or a VirtualBox problem, but since the\r\nproblem occurs with several gcc versions and only appears when writing to the\r\nhost filesystem, it seems to be related to VirtualBox.\r\n	defect	closed	major	shared folders	VirtualBox 2.2.4	fixed	shared folders		Linux	other
