--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/sys_decoder_vopsedec.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/sys_decoder_vopsedec.cpp
@@ -2813,9 +2813,11 @@
 	else
 		write420_jnt_withMask(pfYUV, currY, currU, currV, currBY, currBUV, width, height);
 //~OBSSFIX_MODE3
-    fwrite(currBY, sizeof (PixelC), width*height, pfSeg);
+    int ret;
+    ret = fwrite(currBY, sizeof (PixelC), width*height, pfSeg);
+        if (1 && ret < 1)
+                perror("fwrite");
 #endif
-
     delete currY;
     delete currU;
     delete currV;
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/sys_tps_bfshape.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/sys_tps_bfshape.cpp
@@ -132,6 +132,7 @@
 
 Void write420_sep(Int num, char *name, PixelC* destY, PixelC* destU, PixelC* destV, Int width, Int height) // modified by Sharp (98/10/26)
 {
+	int ret;
 #ifdef __OUT_ONE_FRAME_
   char file[100];
 #endif
@@ -143,23 +144,37 @@
   sprintf(file, "%s%d", name ,num);
   fp = fopen(file, "wb");
 #endif
-  fwrite(destY, sizeof (PixelC), width*height, fp);
-  fwrite(destU, sizeof (PixelC), width*height/4, fp);
-  fwrite(destV, sizeof (PixelC), width*height/4, fp);
+  ret = fwrite(destY, sizeof (PixelC), width*height, fp);
+	if (1 && ret < 1)
+		perror("fwrite");
+  ret = fwrite(destU, sizeof (PixelC), width*height/4, fp);
+	if (1 && ret < 1)
+		perror("fwrite");
+  ret = fwrite(destV, sizeof (PixelC), width*height/4, fp);
+	if (1 && ret < 1)
+		perror("fwrite");
   fclose(fp);
 }
 
 // begin: added by Sharp (98/10/26)
 Void write420_jnt(FILE *fp, PixelC* destY, PixelC* destU, PixelC* destV, Int width, Int height)
 {
-  fwrite(destY, sizeof (PixelC), width*height, fp);
-  fwrite(destU, sizeof (PixelC), width*height/4, fp);
-  fwrite(destV, sizeof (PixelC), width*height/4, fp);
+	int ret;
+  ret = fwrite(destY, sizeof (PixelC), width*height, fp);
+	if (1 && ret < 1)
+		perror("fwrite");
+  ret = fwrite(destU, sizeof (PixelC), width*height/4, fp);
+	if (1 && ret < 1)
+		perror("fwrite");
+  ret = fwrite(destV, sizeof (PixelC), width*height/4, fp);
+	if (1 && ret < 1)
+		perror("fwrite");
 }
 // end: added by Sharp (98/10/26)
 //OBSSFIX_MODE3
 Void write420_jnt_withMask(FILE *fp, PixelC* destY, PixelC* destU, PixelC* destV, PixelC* destBY, PixelC* destBUV, Int width, Int height)
 {
+	int ret;
 	unsigned char pxlZeroY = 0 ;
 	unsigned char pxlZeroUV = 128;
 	unsigned char* destBUV_tmp = destBUV;
@@ -167,24 +182,54 @@
 
 	for (i=0; i < height; i++){
 		for (j=0; j < width; j++){
-			if ( *destBY == MPEG4_OPAQUE)	fwrite(destY, sizeof (unsigned char), 1, fp);
-			else					fwrite(&pxlZeroY, sizeof (unsigned char), 1, fp);
+			if ( *destBY == MPEG4_OPAQUE)
+			{
+				ret =  fwrite(destY, sizeof (unsigned char), 1, fp);
+					if (1 && ret < 1)
+						perror("fwrite");
+			}
+			else
+			{
+				ret = fwrite(&pxlZeroY, sizeof (unsigned char), 1, fp);
+					if (1 && ret < 1)
+						perror("fwrite");
+			}
 			destY++; 
 			destBY++;
 		}
 	}
 	for (i=0; i < height/2; i++){
 		for (j=0; j < width/2; j++){
-			if ( *destBUV == MPEG4_OPAQUE)fwrite(destU, sizeof (unsigned char), 1, fp);
-			else					fwrite(&pxlZeroUV, sizeof (unsigned char), 1, fp);
+			if ( *destBUV == MPEG4_OPAQUE)
+			{
+				ret = fwrite(destU, sizeof (unsigned char), 1, fp);
+					if (1 && ret < 1)
+						perror("fwrite");
+			}
+			else
+			{
+				ret = fwrite(&pxlZeroUV, sizeof (unsigned char), 1, fp);
+					if (1 && ret < 1)
+						perror("fwrite");
+			}
 			destU++; 
 			destBUV++;
 		}
 	}
 	for (i=0; i < height/2; i++){
 		for (j=0; j < width/2; j++){
-			if ( *destBUV_tmp == MPEG4_OPAQUE)fwrite(destV, sizeof (unsigned char), 1, fp);
-			else						fwrite(&pxlZeroUV, sizeof (unsigned char), 1, fp);
+			if ( *destBUV_tmp == MPEG4_OPAQUE)
+			{
+				ret = fwrite(destV, sizeof (unsigned char), 1, fp);
+					if (1 && ret < 1)
+						perror("fwrite");
+			}
+			else
+			{
+				ret = fwrite(&pxlZeroUV, sizeof (unsigned char), 1, fp);
+					if (1 && ret < 1)
+						perror("fwrite");
+			}
 			destV++;
 			destBUV_tmp++;
 		}
@@ -193,12 +238,15 @@
 //~OBSSFIX_MODE3
 Void write_seg_test(Int num, char *name, PixelC* destY, Int width, Int height)
 {
+  int ret;
   char file[100];
   FILE *fp;
 
   sprintf(file, "%s%d", name ,num);
   fp = fopen(file, "a");
-  fwrite(destY, sizeof (PixelC), width*height, fp);
+  ret = fwrite(destY, sizeof (PixelC), width*height, fp);
+	if (1 && ret < 1)
+		perror("fwrite");
   fclose(fp);
 }
 
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/sys_vopses.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/sys_vopses.cpp
@@ -1153,18 +1153,23 @@
 	// black frame
 	Int iW = rct.width;
 	Int iH = rct.height();
-	Int i;
+	Int i, ret;
+	ret = 0;
 
 	PixelC *ppxlcPix = new PixelC [iW];
 
 	pxlcmemset(ppxlcPix, 0, iW);
 	for(i=0; i<iH; i++) // Y
-		fwrite(ppxlcPix, sizeof(PixelC), iW, pfYUV);
+		ret = fwrite(ppxlcPix, sizeof(PixelC), iW, pfYUV);
+			if (1 && ret < 1)
+				perror("fwrite");
 
 	if(pfSeg!=NULL)
 	{
 		for(i=0; i<iH; i++) // A
-			fwrite(ppxlcPix, sizeof(PixelC), iW, pfSeg);
+			ret = fwrite(ppxlcPix, sizeof(PixelC), iW, pfSeg);
+				if (1 && ret < 1)
+					perror("fwrite");
 	}
 	if(ppfAux!=NULL)
 	{
@@ -1173,14 +1178,18 @@
 			if(ppfAux[iAux]!=NULL)
 			{
 				for(i=0; i<iH; i++)
-					fwrite(ppxlcPix, sizeof(PixelC), iW, ppfAux[iAux]);
+					ret = fwrite(ppxlcPix, sizeof(PixelC), iW, ppfAux[iAux]);
+						if (1 && ret < 1)
+							perror("fwrite");
 			}
 	}
 
 	PixelC pxlcValUV = 1<<(nBits-1);
 	pxlcmemset(ppxlcPix, pxlcValUV, iW>>1);
 	for(i=0; i<iH; i++) // UV
-		fwrite(ppxlcPix, sizeof(PixelC), iW>>1, pfYUV);
+		ret = fwrite(ppxlcPix, sizeof(PixelC), iW>>1, pfYUV);
+			if (1 && ret < 1)
+				perror("fwrite");
 
 	delete ppxlcPix;
 }
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_grayc.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_grayc.cpp
@@ -1646,6 +1646,7 @@
 	
 Void CU8Image::dump (FILE* pf, const CRct& rct, Int iScale) const
 {
+	int ret;
 	CRct rctRegionOfInterest = (!rct.valid ()) ? where () : rct;
 	assert (rctRegionOfInterest <= where ());
 	iScale++;
@@ -1658,7 +1659,9 @@
 			for(j = 0; j <rctRegionOfInterest.width; j++)
 			{
 				pxlTmp = (ppxlc[j]*iScale)>>8;
-				fwrite(&pxlTmp, sizeof(PixelC), 1, pf);
+				ret = fwrite(&pxlTmp, sizeof(PixelC), 1, pf);
+					if (1 && ret < 1)
+						perror("fwrite");
 			}
 			ppxlc += where ().width;
 		}
@@ -1669,14 +1672,18 @@
 	/* NBIT: change U8 to PixelC
 			fwrite (m_ppxlc, sizeof (U8), where ().area (), pf);
 	*/
-			fwrite (m_ppxlc, sizeof (PixelC), where ().area (), pf);
+			ret = fwrite (m_ppxlc, sizeof (PixelC), where ().area (), pf);
+				if (1 && ret < 1)
+					perror("fwrite");
 		} else {
 			const PixelC* ppxlc = pixels (rctRegionOfInterest.left, rctRegionOfInterest.top);
 			for (Int i = rctRegionOfInterest.top; i < rctRegionOfInterest.bottom; i++)	{
 	/* NBIT: change U8 to PixelC
 				fwrite (ppxlc, sizeof (U8), rctRegionOfInterest.width, pf);
 	*/
-				fwrite (ppxlc, sizeof (PixelC), rctRegionOfInterest.width, pf);
+				ret = fwrite (ppxlc, sizeof (PixelC), rctRegionOfInterest.width, pf);
+					if (1 && ret < 1)
+						perror("fwrite");
 				ppxlc += where ().width;
 			}
 		}
@@ -1689,7 +1696,7 @@
 	CRct rctRegionOfInterest = (!rct.valid ()) ? where () : rct;
 	assert (rctRegionOfInterest <= where ());
 	assert (rctRegionOfInterest <= puciMask->where ());
-	Int x;
+	Int x, ret = 0;
 	const PixelC* ppxlc = pixels (rctRegionOfInterest.left, rctRegionOfInterest.top);
 	const PixelC* ppxlcMask = puciMask->pixels(rctRegionOfInterest.left, rctRegionOfInterest.top);
 	iScale++;
@@ -1699,16 +1706,22 @@
 /* NBIT: change
 				fputc(0, pf);
 */
-				fwrite(&pxlZero, sizeof(PixelC), 1, pf);
+				ret = fwrite(&pxlZero, sizeof(PixelC), 1, pf);
+					if (1 && ret < 1)
+						perror("fwrite");
 			else if(iScale==256)
 /* NBIT: change
 				fputc(ppxlc[x], pf);
 */
-				fwrite(&ppxlc[x], sizeof(PixelC), 1, pf);
+				ret = fwrite(&ppxlc[x], sizeof(PixelC), 1, pf);
+					if (1 && ret < 1)
+						perror("fwrite");
 			else
 			{
 				pxlTmp = (ppxlc[x] * iScale)>>8;
-				fwrite(&pxlTmp, sizeof(PixelC), 1, pf);
+				ret = fwrite(&pxlTmp, sizeof(PixelC), 1, pf);
+					if (1 && ret < 1)
+						perror("fwrite");
 			}
 
 		ppxlc += where ().width;
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_grayf.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_grayf.cpp
@@ -1440,6 +1440,7 @@
 	
 Void CFloatImage::dump (FILE* pf) const
 {
+	int ret;
 	assert (pf != NULL);
 	UInt area = where ().area ();
 	U8* rguchPixelData = new U8 [where().area()];
@@ -1449,7 +1450,9 @@
 		U8 vl = (U8) checkrange (*ppxlf, 0.0f, 255.0f);
 		*puch = vl;
 	}
-	fwrite (rguchPixelData, sizeof (U8), area, pf);
+	ret = fwrite (rguchPixelData, sizeof (U8), area, pf);
+		if (1 && ret < 1)
+			perror("fwrite");
 	delete [] rguchPixelData;
 }
 	
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_grayi.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_grayi.cpp
@@ -1298,6 +1298,7 @@
 	// was a binary write, but now reflects code in CFloatImage::dump()
 	//fwrite (m_ppxli, sizeof (Int), where ().area (), pf);
 
+	int ret;
 	assert (pf != NULL);
 	UInt area = where ().area ();
 	U8* rguchPixelData = new U8 [where().area()];
@@ -1307,7 +1308,9 @@
 		U8 vl = (U8) checkrange ((Int)*ppxli, (Int)0, (Int)255);
 		*puch = vl;
 	}
-	fwrite (rguchPixelData, sizeof (U8), area, pf);
+	ret = fwrite (rguchPixelData, sizeof (U8), area, pf);
+		if (1 && ret < 1)
+			perror("fwrite");
 	delete [] rguchPixelData;
 }
 	
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_vop.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_vop.cpp
@@ -134,11 +134,20 @@
 	Int c1 = getc (pf);
 	assert (c0 == 'V' && (c1 == 'M' || c1 == 'B') );
 	CRct rc;
+	int ret;
 	if (c1 == 'M'){
-		fread (&rc.left, sizeof (CoordI), 1, pf);
-		fread (&rc.top, sizeof (CoordI), 1, pf);
-		fread (&rc.right, sizeof (CoordI), 1, pf);
-		fread (&rc.bottom, sizeof (CoordI), 1, pf);
+		ret = fread (&rc.left, sizeof (CoordI), 1, pf);
+			if (1 && ret < 1)
+				perror("fread");
+		ret = fread (&rc.top, sizeof (CoordI), 1, pf);
+			if (1 && ret < 1)
+                                perror("fread");
+		ret = fread (&rc.right, sizeof (CoordI), 1, pf);
+			if (1 && ret < 1)
+                                perror("fread");
+		ret = fread (&rc.bottom, sizeof (CoordI), 1, pf);
+			if (1 && ret < 1)
+                                perror("fread");
 		rc.width = rc.right - rc.left;
 	}
 	else {
@@ -176,7 +185,9 @@
 	allocate (rc);
 
 	// read the actual data
-	fread (m_ppxl, sizeof (CPixel), where ().area (), pf);
+	ret = fread (m_ppxl, sizeof (CPixel), where ().area (), pf);
+		if (1 && ret < 1)
+			perror("fread");
 	fclose (pf);
 }
 
@@ -1046,19 +1057,28 @@
 
 Void CVideoObjectPlane::vdlDump (const Char* fileName, CPixel ppxlFalse) const
 {
+	int ret;
 	if (!valid ()) return;
 	FILE* pf = fopen (fileName, "wb");
 	// write overhead
 	putc ('V', pf);
 	putc ('M', pf);
 	CoordI cord = (CoordI) where ().left;
-	fwrite (&cord, sizeof (CoordI), 1, pf);
+	ret = fwrite (&cord, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+			perror("fwrite");
 	cord = (CoordI) where ().top;
-	fwrite (&cord, sizeof (CoordI), 1, pf);
+	ret = fwrite (&cord, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+                        perror("fwrite");
 	cord = (CoordI) where ().right;
-	fwrite (&cord, sizeof (CoordI), 1, pf);
+	ret = fwrite (&cord, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+                        perror("fwrite");
 	cord = (CoordI) where ().bottom;
-	fwrite (&cord, sizeof (CoordI), 1, pf);
+	ret = fwrite (&cord, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+                        perror("fwrite");
 
 	// dump the actual data
 	UInt area = where ().area ();
@@ -1070,13 +1090,16 @@
 			pp.pxlU.rgb.g = ppxlFalse.pxlU.rgb.g;
 			pp.pxlU.rgb.b = ppxlFalse.pxlU.rgb.b;
 		}
-		fwrite (&pp, sizeof (CPixel), 1, pf);
+		ret = fwrite (&pp, sizeof (CPixel), 1, pf);
+			if (1 && ret < 1)
+                        	perror("fwrite");
 	}
 	fclose (pf);
 }
 
 Void CVideoObjectPlane::vdlByteDump (const Char* fileName, CPixel ppxlFalse) const
 {
+	int ret;
 	if (!valid ()) return;
 	FILE* pf = fopen (fileName, "wb");
 	// write overhead
@@ -1127,7 +1150,9 @@
 			pp.pxlU.rgb.g = ppxlFalse.pxlU.rgb.g;
 			pp.pxlU.rgb.b = ppxlFalse.pxlU.rgb.b;
 		}
-		fwrite (&pp, sizeof (CPixel), 1, pf);
+		ret = fwrite (&pp, sizeof (CPixel), 1, pf);
+			if (1 && ret < 1)
+                        	perror("fwrite");
 	}
 	fclose (pf);
 }
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_yuvac.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/type_yuvac.cpp
@@ -163,18 +163,31 @@
 	m_puciY (NULL), m_puciU (NULL), m_puciV (NULL), m_puciBY (NULL), m_puciBUV (NULL), m_ppuciA (NULL),
 	m_pppxlcA(NULL), m_pppxlcBoundA(NULL)
 {
+	int ret;
 	FILE* pf = fopen (sptFilename, "rb");
 	// read overhead
 	Int c0 = getc (pf);
 	Int c1 = getc (pf);
 	Int c2 = getc (pf);
 	assert (c0 == 'S' && (c1 == 'P' || c2 == 'T') );
-	fread (&m_rctY.left, sizeof (CoordI), 1, pf);
-	fread (&m_rctY.top, sizeof (CoordI), 1, pf);
-	fread (&m_rctY.right, sizeof (CoordI), 1, pf);
-	fread (&m_rctY.bottom, sizeof (CoordI), 1, pf);
-	fread (&m_fAUsage, sizeof (Int), 1, pf);
-	fread (&m_iAuxCompCount, sizeof (Int), 1, pf);
+	ret = fread (&m_rctY.left, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+                        perror("fread");
+	ret = fread (&m_rctY.top, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+                        perror("fread");
+	ret = fread (&m_rctY.right, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+                        perror("fread");
+	ret = fread (&m_rctY.bottom, sizeof (CoordI), 1, pf);
+		if (1 && ret < 1)
+                        perror("fread");
+	ret = fread (&m_fAUsage, sizeof (Int), 1, pf);
+		if (1 && ret < 1)
+                        perror("fread");
+	ret = fread (&m_iAuxCompCount, sizeof (Int), 1, pf);
+		if (1 && ret < 1)
+                        perror("fread");
 	m_rctY.width = m_rctY.right - m_rctY.left;
 	m_rctUV = m_rctY.downSampleBy2 ();
 	m_puciY = new CU8Image (m_rctY);
@@ -208,15 +221,25 @@
 		}
 	}
 	// read the actual data
-	fread (m_ppxlcY, sizeof (U8), m_rctY.area (), pf);
-	fread (m_ppxlcU, sizeof (U8), m_rctUV.area (), pf);
-	fread (m_ppxlcV, sizeof (U8), m_rctUV.area (), pf);
+	ret = fread (m_ppxlcY, sizeof (U8), m_rctY.area (), pf);
+		if (1 && ret < 1)
+                        perror("fread");
+	ret = fread (m_ppxlcU, sizeof (U8), m_rctUV.area (), pf);
+		if (1 && ret < 1)
+                        perror("fread");
+	ret = fread (m_ppxlcV, sizeof (U8), m_rctUV.area (), pf);
+		if (1 && ret < 1)
+                        perror("fread");
 	if (m_fAUsage != RECTANGLE) {
 		if (m_fAUsage == EIGHT_BIT) {
 			for(Int iAuxComp=0;iAuxComp<m_iAuxCompCount;iAuxComp++) // MAC (SB) 25-Nov-99
-				fread ((PixelC*) m_pppxlcA[iAuxComp], sizeof (U8), m_rctY.area (), pf);
+				ret = fread ((PixelC*) m_pppxlcA[iAuxComp], sizeof (U8), m_rctY.area (), pf);
+					if (1 && ret < 1)
+			                        perror("fread");
 		} else
-			fread ((PixelC*) m_ppxlcBY, sizeof (U8), m_rctY.area (), pf);
+			ret = fread ((PixelC*) m_ppxlcBY, sizeof (U8), m_rctY.area (), pf);
+				if (1 && ret < 1)
+		                        perror("fread");
 	}
 	fclose (pf);
 }
@@ -555,9 +578,16 @@
 
 Void CVOPU8YUVBA::dump (FILE* pfFile) const
 {
-	fwrite (m_ppxlcY, m_rctY .area(), 1, pfFile);
-	fwrite (m_ppxlcU, m_rctUV.area(), 1, pfFile);
-	fwrite (m_ppxlcV, m_rctUV.area(), 1, pfFile);
+	int ret;
+	ret = fwrite (m_ppxlcY, m_rctY .area(), 1, pfFile);
+		if (1 && ret < 1)
+                        perror("fwrite");
+	ret = fwrite (m_ppxlcU, m_rctUV.area(), 1, pfFile);
+		if (1 && ret < 1)
+                        perror("fwrite");
+	ret = fwrite (m_ppxlcV, m_rctUV.area(), 1, pfFile);
+		if (1 && ret < 1)
+                        perror("fwrite");
 }
 
 Void CVOPU8YUVBA::dump (const Char* pchFileName) const
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/vtc_main_vtcenc.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/vtc_main_vtcenc.cpp
@@ -1510,8 +1510,11 @@
 			{
 				unsigned char byte_buf;
 				Int bits;
+				int ret;
 
-				fread(&byte_buf, sizeof(char), 1, bitfile);
+				ret = fread(&byte_buf, sizeof(char), 1, bitfile);
+					if (1 && ret < 1)
+			                        perror("fread");
 				fflush(bitfile);
 				fseek(bitfile, -1L, SEEK_CUR);
 				byte_buf = (byte_buf >> (8 - used_bits));
@@ -1523,7 +1526,9 @@
 					bits = emit_bits_local ( 1, 1, bitfile );
 				}
 				fflush(bitfile);
-				fread(&byte_buf, sizeof(char), 1, bitfile);
+				ret = fread(&byte_buf, sizeof(char), 1, bitfile);
+					if (1 && ret < 1)
+						perror("fread");
 				fflush(bitfile);
 				fseek(bitfile, -1L, SEEK_CUR);
 				emit_bits_local ( byte_buf, bits, bitfile );
@@ -1686,6 +1691,7 @@
     static UInt buf = 0;
     UInt put_buffer = data;
     unsigned char c;
+    int ret;
 
 		assert(sizeof(UShort)==2);
     /* Mask off any excess bits in code */
@@ -1704,7 +1710,9 @@
         c = (unsigned char) ((put_buffer >> 16) & 0xFF);
 //				printf("%d at %d\n", c, ftell(fp));
 //				getchar();
-        fwrite(&c, sizeof(char), 1, fp);
+        ret = fwrite(&c, sizeof(char), 1, fp);
+		if (1 && ret < 1)
+			perror("fwrite");
         put_buffer <<= 8;
         remain_bits    -= 8;
     }
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/vtc_main_write_image.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/vtc_main_write_image.cpp
@@ -368,6 +368,7 @@
 {
 		FILE *fp;
 		Int col;
+		int ret = 0;
 		Int dWidth[3], dHeight[3];
 
 		dWidth[0] = mzte_codec.m_display_width;
@@ -381,7 +382,9 @@
 
 		noteProgress("Writing reconstructed image '%s'(%dx%d) ...",recImgFile, dWidth[0], dHeight[0]);
 		for ( col=0; col<mzte_codec.m_iColors; col++ )
-			fwrite(frm[col], 1, dWidth[col]*dHeight[col], fp);
+			ret = fwrite(frm[col], 1, dWidth[col]*dHeight[col], fp);
+				if (1 && ret < 1)
+					perror("fwrite");
 		fclose(fp);
 }
 
--- mpeg4ip-1.4.1/common/video/iso-mpeg4/src/vtc_zte_bitpack.cpp
+++ mpeg4ip-1.4.1/common/video/iso-mpeg4/src/vtc_zte_bitpack.cpp
@@ -164,8 +164,11 @@
 /* Outputting bytes to the file */
 Void CVTCCommon::flush_bytes1()
 {
+  int ret;
   if (bytes_in_buffer) {  
-     fwrite(output_buffer, bytes_in_buffer, sizeof(UChar), bitfile);
+     ret = fwrite(output_buffer, bytes_in_buffer, sizeof(UChar), bitfile);
+		if (1 && ret < 1)
+			perror("fwrite");
   }
 
   bytes_in_buffer = 0;
@@ -177,8 +180,11 @@
 /* Outputting bytes to the file and count the last few bits, used by main.c */
 Void CVTCEncoder::flush_bytes()
 {
+  int ret;
   if (bytes_in_buffer) {
-     fwrite(output_buffer, bytes_in_buffer, sizeof(UChar), bitfile);
+     ret = fwrite(output_buffer, bytes_in_buffer, sizeof(UChar), bitfile);
+		if (1 && ret < 1)
+			perror("fwrite");
      totalBitRate +=8-totalBitRate%8;
   }
   bytes_in_buffer = 0;
@@ -854,6 +860,7 @@
 Void CVTCEncoder::write_packet_header_to_file()
 {
   Int i,k;
+  int ret;
   UChar temp[12];
 
   TU_buf_len=0;
@@ -867,8 +874,9 @@
   temp[2]=128|(TU_buf[0]>>1);
   for(i=1,k=3;i<TU_buf_len;i++,k++)
     temp[k]=(TU_buf[i-1]<<7)|(TU_buf[i]>>1);
-  fwrite(temp,sizeof(UChar),k,bitfile); /* write header part to file before
-                                           data */
+  ret = fwrite(temp,sizeof(UChar),k,bitfile); /* write header part to file before data */
+	  if (1 && ret < 1)
+		perror("fwrite");
 
  /* count overheads, 17 resynch, 16 TU, 1 HEC, bbc, 7/9/98 */
   totalBitRate +=k<<3;
