[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Texmacs-dev] Strange bug with C++
From: |
Joris van der Hoeven |
Subject: |
[Texmacs-dev] Strange bug with C++ |
Date: |
Mon, 28 Apr 2003 12:17:42 +0200 (CEST) |
Someone has an idea why the following code yields
a segmentation fault since more than five years?
I fixed that by not using fstream at all,
but that seems a bit ridiculous when using C++...
----------------------------------------------
bool
load_string (url u, string& s, bool fatal) {
string name= concretize (u);
char* _name= as_charp (name);
bool err= !is_rooted_name (u);
if (!err) {
cout << "opening " << name << "\n";
ifstream fin (_name);
cout << "opened\n";
if (!fin) err= true;
if (!err) {
char c;
while (fin.get (c)) s << c;
if (!fin.eof ()) err= true;
}
}
cout << "read " << s << "\n";
if (err && fatal)
fatal_error (as_string (u) * " not readable", "load_string");
delete[] _name;
return err;
}
-----------------------------------------------
- [Texmacs-dev] Strange bug with C++,
Joris van der Hoeven <=