This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

file-IO and mno-cygwin


Hi all,
I have a problem doing file IO with the mno-cygwin flag. Maybe I'm just
too stupid to correctly give the path and filename, but please, look for
yourself:

Given the following code:

#include <iostream>
#include <fstream>
using namespace std;

int main()
{
     ofstream opstream("c:\example.txt");
     if(!opstream) { cerr << "File cannot be opened.\n";    return
1;     }
     opstream <<  << "Test stream."; opstream.close();
     return 0;
}

I tried several possibilities to specify the filename in ofstream
opstream() and have two different results (compiling with: $ gcc
test.cpp -o test.exe -I/usr/local/mingw32/include
-L/usr/local/mingw32/lib -mno-cygwin -lstdc++):

-  specifying "c:\example.txt" results in the File cannot be opened
message;
-  specifying "example.txt" or "c:\\example.txt" results in a Windows
error but
                 also  produces if not already existing an empty
'example.txt file.

I hope, you don't consider this off-topic, I finally thought it's a
cygwin problem, but unfortunately I didn't find any explanation,
workaround... for this in the faq and archives, so, any help would be
really apreciated.

Tilman

PS: I have Win98 SE, cygwin.dll 1.1.7-1, gcc 2.95.2-6


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]