- */
-void gdcmBinEntry::Write(FILE *fp, FileType filetype) {
- gdcmDocEntry::Write(fp, filetype);
- void *voidArea = GetVoidArea();
- int lgr=GetLength();
- if (voidArea != NULL)
- { // there is a 'non string' LUT, overlay, etc
- fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value
- return;
- }
+ * @param fp already open file pointer
+ * @param filetype type of the file to be written
+*/
+void BinEntry::Write(std::ofstream* fp, FileType filetype)
+{
+ DocEntry::Write(fp, filetype);
+ void* binArea = GetBinArea();
+ int lgr = GetLength();
+ if (binArea)
+ {
+ // there is a 'non string' LUT, overlay, etc
+ fp->write ( (char*)binArea, lgr ); // Elem value
+ //assert( strlen((char*)binArea) == lgr );
+
+ }
+ else
+ {
+ // nothing was loaded, but we need to skip space on disc
+ fp->seekp(lgr, std::ios_base::cur);
+ }