[filesystem] wfstream file open does not create file in std::ios_base::out mode

Hello, I am using boost version 1.42 and the below code is tested on Windows Xp SP3 and Suse 11.2 The below code creates new file when opened using fstream object, but fails to create when opened using wftream object. This behavior is consistent across platforms (Windows and Linux). Also the error code which I get after fileHandleW.open call is, 1. ERROR_FILE_NOT_FOUND for std::ios_base::out 2. ERROR_NEGATIVE_SEEK for std::ios_base::app In case of append mode, the file gets created. But still I get the above mentioned error code. #include "boost/filesystem/fstream.hpp" int main() { boost::filesystem::path pA("C:\\testA.txt"); boost::filesystem::wpath pW(L"C:\\testW.txt"); boost::filesystem::fstream fileHandleA; boost::filesystem::wfstream fileHandleW; fileHandleA.open(pA, std::ios_base::out); fileHandleW.open(pW, std::ios_base::out); return 0; } Kindly help me in this regard. Regards, Kiran ________________________________ Important notice: This e-mail and any attachment there to contains corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank You.

On Thu, Jun 17, 2010 at 9:48 AM, Ramakrishna, Kirankumar IN BLR SISL <Kiran.Ramakrishna@siemens.com> wrote:
Hello,
I am using boost version 1.42 and the below code is tested on Windows Xp SP3 and Suse 11.2
The below code creates new file when opened using fstream object, but fails to create when opened using wftream object. This behavior is consistent across platforms (Windows and Linux). Also the error code which I get after fileHandleW.open call is,
1. ERROR_FILE_NOT_FOUND for std::ios_base::out 2. ERROR_NEGATIVE_SEEK for std::ios_base::app
In case of append mode, the file gets created. But still I get the above mentioned error code.
#include "boost/filesystem/fstream.hpp"
int main() { boost::filesystem::path pA("C:\\testA.txt"); boost::filesystem::wpath pW(L"C:\\testW.txt"); boost::filesystem::fstream fileHandleA; boost::filesystem::wfstream fileHandleW; fileHandleA.open(pA, std::ios_base::out); fileHandleW.open(pW, std::ios_base::out); return 0; }
I didn't have a copy of 1.42 handy, so tested against the current trunk, using VC++ 9. Your program worked fine, and the two files were created. Are you still having problems? Perhaps upgrading to 1.43 would help. --Beman
participants (2)
-
Beman Dawes
-
Ramakrishna, Kirankumar IN BLR SISL