Hi,
I try to read array data from a stream with the >> operator
but it seems, like the array size cannot be interpreted.
This is the code of my minimal sample:
#include <fstream>
#include <iostream>
#include "blitz/array.h"
using namespace std;
using namespace blitz;
int main() {
std::string inputfilename ="A.dat";
std::ifstream ifsx(inputfilename.c_str(),std::ios::in);
if (!ifsx.good())
{
cout << "Unable to open file: " << inputfilename;
return EXIT_FAILURE;
} else
std::cout << "reading input data from " << inputfilename << std::endl;
Array<double,2> A;
ifsx >> A;
std::cout << "A: " << A;
std::cout << "size x: " << A.extent(0) << std::endl;;
std::cout << "size y: " << A.extent(1)<< std::endl; ;
return EXIT_SUCCESS;
}
A.dat:
-----------
3 x 3
[
0 1 0
1 -4 1
0 1 0
]
The program prints out something like
A: (-8860,-8852) x (32767,32767)
[ weired numbers, zeros or nothing ..
]
or simple throws: St9bad_alloc
the compiler is gcc 4.1.2,
Is this a bug am I'm doing something wrong?
Everything else I tried so far works perfectly.
Regards,
Harris
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
|