X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Farray2dfile.cpp;h=40be226ee82c45ec0f523f41aa4842ff57fd5c4a;hp=b16c7d3b7810db59fd734e8cca62c24fe73e1201;hb=e0fe7f917f52ea92621348e501400a3d1e9da96d;hpb=ee0105d74fec9d6bfd236e22e9e1d315e46c568e diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index b16c7d3..40be226 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.cpp,v 1.15 2000/12/06 01:46:43 kevin Exp $ +** $Id: array2dfile.cpp,v 1.18 2000/12/15 22:07:35 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 @@ -26,9 +26,10 @@ ******************************************************************************/ #include "array2dfile.h" -#include -#include - +#include +#ifdef MSVC +typedef long off_t; +#endif using namespace std; @@ -108,9 +109,10 @@ Array2dFileLabel::getDateTime (int& year, int& month, int& day, int& hour, int& const string& Array2dFileLabel::getDateString (void) const { - ostringstream oss; - oss << static_cast(m_month + 1) <<"/"<< static_cast(m_day) <<"/"<< static_cast(m_year + 1900) << " " << static_cast(m_hour) <<":"<< static_cast(m_minute) <<":"<< static_cast(m_second); - m_strDate = oss.str(); + char szDate [128]; + snprintf (szDate, sizeof(szDate), "%2d/%02d/%4d %02d:%02d:%02d", + m_month + 1, m_day, m_year + 1900, m_hour, m_minute, m_second); + m_strDate = szDate; return m_strDate; } @@ -553,9 +555,11 @@ Array2dFile::labelAdd (const Array2dFileLabel& label) } void -Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const idStr) +Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const pszId) { - string id = idStr; + string id; + if (pszId) + id = pszId; for (unsigned int i = 0; i < copyFile.getNumLabels(); i++) { Array2dFileLabel l (copyFile.labelGet (i)); string lstr = l.getLabelString();