|
Boost : |
Subject: Re: [boost] [filesystem] wfstream file open does not create file in std::ios_base::out mode
From: Beman Dawes (bdawes_at_[hidden])
Date: 2010-06-23 07:20:25
On Wed, Jun 23, 2010 at 4:27 AM, Ramakrishna, Kirankumar IN BLR SISL
<Kiran.Ramakrishna_at_[hidden]> wrote:
> Hi,
>
> I upgraded to boost version 1.43, but that did not help. Still file creation fails with wfstream and error code set is ERROR_FILE_NOT_FOUND.
> Below code captures the error codes
>
> #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);
> cout << "fileHandleA.fail() return value is: " << fileHandleA.fail() << endl;
> cout << "Error code is: " << GetLastError() << endl;
> fileHandleW.open(pW, std::ios_base::out);
> cout << "fileHandleW.fail() return value is: " << fileHandleW.fail() << endl;
> cout << "Error code is: " << GetLastError() << endl;
> return 0;
> }
>
> Am I doing something wrong?
Please, this isn't the right place to post "How do I program in C++?"
level questions.
The above program won't compile. Beyond the obvious errors, it uses
poor practices like writing test files to the root directory.
And, once the errors are corrected, it does run OK, at least on the
trunk. Sorry, but you have exhausted my patience so I didn't try it on
the actual 1.43 release.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk