Program: gdcm
Module: $RCSfile: gdcmValEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:48 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2004/11/03 20:52:13 $
+ Version: $Revision: 1.32 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
+#include <fstream>
+
namespace gdcm
{
/*
* \brief canonical Writer
*/
-void ValEntry::Write(FILE* fp, FileType filetype)
+void ValEntry::Write(std::ofstream* fp, FileType filetype)
{
DocEntry::Write(fp, filetype);
for (unsigned int i=0; i<tokens.size();i++)
{
uint16_t val_uint16 = atoi(tokens[i].c_str());
- void* ptr = &val_uint16;
- fwrite ( ptr,(size_t)2 ,(size_t)1 ,fp);
+ binary_write( *fp, val_uint16);
}
tokens.clear();
return;
for (unsigned int i=0; i<tokens.size();i++)
{
uint32_t val_uint32 = atoi(tokens[i].c_str());
- void* ptr = &val_uint32;
- fwrite ( ptr,(size_t)4 ,(size_t)1 ,fp);
+ binary_write( *fp, val_uint32);
}
tokens.clear();
return;
}
- fwrite (GetValue().c_str(), (size_t)lgr ,(size_t)1, fp); // Elem value
+ fp->write (GetValue().c_str(), (size_t)lgr ); // Elem value
+// assert( lgr == GetValue().size() ); // FIXME ?????
+// dbg.Assert(2, lgr == strlen(GetValue().c_str()), "Should be equal" );
}
//-----------------------------------------------------------------------------