From: Jim G. <jgreen@RobotVision.com> - 2007-10-04 20:19:37
|
Let me be more precise about what I asked. Fred Wheeler responded to my first post suggesting I look at a C++ site that has examples. I looked, and the examples there were about like the examples in my C++ books. But to be more specific, the book and site suggest the following includes: #include <iostream>; #include <fstream>; using namespace std; For vxl I translated this into: #include <vcl_iostream.h> #include <vcl_fstream.h> Note that I did NOT use the "using namespace std;", fearing that would completely crash vxl. The book and site then recommend something like my code here to define an output file stream and open the file for writing: ofstream outfile; outfile.open("C:\temp\gauss_fit.txt"); With the 2 header files above, the VS C++ compiler complains that ofstream is an "undeclared identifier", which usually means the correct .h file was not included. According to all the books and other references, this is the proper way to open an output file stream in C++. Why won't it work in vxl using the vcl_** headers? Should I change to the Microsoft supplied headers for this app? Thanks, Jim Green -------------------------------------------------------------- Group, The vcl documentation is not very clear about the relation of vcl_iostream to ofstream. I need to do a simple file open and write text strings to the file. I'd like to use the << operator, like in "vcl_cout <<". I included the vcl_iostream.h header, and tried the examples in the VS C++ documentation, but it would not do the definition of an ofstream or open a filename for appending. The vcl/generic/iostream.h file defines a bunch of the ios::(tags), but doesn't mention any methods to open a file, etc. The rest of the .h files just seem to be switches for different compilers. Are there any examples about manipulating file streams in the documentation that I have missed that clarify how to use the features of vcl_iostream? Thanks, Jim Green |