Re: conversion from 'double' to 'unsigned int"

Tech-Archive recommends: Speed Up your PC by fixing your registry



chauhan.alok wrote:

hi
I am a beginner to vc++.

I am opening a file("c:\Mydoc.doc") and reading data from it and after
that i just want to write data of 1.2 MB part from first
file("c:\Mydoc.doc") to New file("c:\Newdoc1.doc") and remaining to
other file("c;\Newdoc2.doc"). Code is Giving warning .
Pls Help me How these waring can be removed?

Code is:
double dSplitsize,dNumBytes;
FILE * oFile , * sFile;
int intnumr;

oFile = fopen ("c:\Mydoc.doc", "rb");
sFile = fopen ("c:\Newdoc1.doc" , "wb" ); dSplitsize=1.2f;
dNumBytes= dSplitsize*1024*1024;
intnumr= fread (buff1,sizeof(char),dNumBytes,oFile);//warning c4244:
intnumw= fwrite(buff1,sizeof(char),dNumBytes,sFile);//warning c4244:

warning C4244: 'argument' : conversion from 'double' to 'unsigned int',
possible loss of data.

Thanks in advance

alok singh chauhan



--
chauhan.alok
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

alok:

You have to cast dNumBytes to unsigned int to get rid of the warning.

David Wilkinson


.