X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fprojections.cpp;h=4c31b3808748681a62e7ae33ad1c25a69ad17307;hp=edbed03dc8ecbea37166d9ebde3589a16f036053;hb=e3776d3d7bf82adfea545c1f06c8b4ce660190b0;hpb=dc034c9d0b7d9c3874a324a4c2c189a02945adc8 diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index edbed03..4c31b38 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: projections.cpp,v 1.32 2000/12/16 06:12:47 kevin Exp $ +** $Id: projections.cpp,v 1.34 2001/01/02 06:29:23 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -71,6 +71,15 @@ Projections::init (const int nView, const int nDet) m_nView = nView; m_nDet = nDet; newProjData (); + + time_t t = time (NULL); + tm* lt = localtime (&t); + m_year = lt->tm_year; + m_month = lt->tm_mon; + m_day = lt->tm_mday; + m_hour = lt->tm_hour; + m_minute = lt->tm_min; + m_second = lt->tm_sec; } void @@ -307,10 +316,14 @@ Projections::read (const std::string& filename) bool Projections::read (const char* filename) { - frnetorderstream fileRead (filename, ios::in | ios::binary); - m_filename = filename; - - if (! fileRead) + m_filename = filename; +#ifdef MSVC + frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary); +#else + frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary | std::ios::nocreate); +#endif + + if (fileRead.fail()) return false; if (! headerRead (fileRead)) @@ -438,17 +451,6 @@ Projections::write (const char* filename) return false; } -#ifdef HAVE_TIME - time_t t = time(NULL); - tm* lt = localtime(&t); - m_year = lt->tm_year; - m_month = lt->tm_mon; - m_day = lt->tm_mday; - m_hour = lt->tm_hour; - m_minute = lt->tm_min; - m_second = lt->tm_sec; -#endif - if (! headerWrite (fs)) return false;