[Dev-C++] Res: Res: error while using the GetFileSize() funtion
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: KrowniX \(\)--\(\) <kr...@ya...> - 2006-12-07 18:33:13
|
Well ...the OpenFile() doesn=B4t work for me....why?=0ABecouse the OpenFile= () function returns a HFILE, and GetFileSize() needs a HANDLE, well I solve= this problem using the FindFirstFile() function and that=B4s ok..but...the= program give me the same results when I was using the FILE *=0A=0ADoes any= one know anything about it..or could just tell me what C Ansi function coul= d solve my problem by giving me the size of the file ?????????=0A=0AKrownix= =0A=0A=0A----- Mensagem original ----=0ADe: KrowniX ()--() <krownix@yahoo.c= om.br>=0APara: dev...@li...=0AEnviadas: Quinta-feira= , 7 de Dezembro de 2006 15:17:03=0AAssunto: [Dev-C++] Res: error while usin= g the GetFileSize() funtion=0A=0A=0AHi,=0A =0AI think i got it;; =0AThe pro= blem is becouse GetFileSize() works with a handle and I was using a FILE * = ...so I think that if I use the OpenFile() function I can solve my problem= ...=0A =0ABut;...until now I haven=B4t found an good example on how to use = OpenFile() so..if anyone knows how...could give me a help....ok!?!=0A =0ATh= anks=0A =0AKrownix=0A=0A=0A----- Mensagem original ----=0ADe: KrowniX ()--(= ) <kr...@ya...>=0APara: dev...@li...=0AEnvi= adas: Quinta-feira, 7 de Dezembro de 2006 12:43:15=0AAssunto: [Dev-C++] err= or while using the GetFileSize() funtion=0A=0A=0AHello..=0A =0AI got a new = situation here ...now I have to verify every 5 minuts the size of a file, b= ut I am using the GetFileSize() function but it=B4s result it isn=B4t like = de DIR command results, ex:=0A =0AMy code:=0Avoid TestSizeLog() {=0A FI= LE *fp; //ponteiro para o arquivo criado=0A DWORD sizeLog; //armazena a= rquivo=0A=0A if(!(fp=3Dfopen("c:\\arq.dat", "r"))) {=0A std::c= out << "Erro ao abrir arquivo de log" << std::endl;=0A exit(1);=0A= }=0A sizeLog=3DGetFileSize(fp, NULL); =0A sizeLog/=3D(1024*102= 4); //transforma bytes em megabytes=0A std::cout << "File Size: " << si= zeLog << std::endl;=0A} =0A =0Athe result of my code:=0AC:\>"\Documents = and Settings\p550826\Desktop\progs\EventViewer\testFile.exe"=0AFile Size: 4= 095=0A =0Athe result of a DIR command:=0A07/12/2006 10:13 33.166.87= 4 arq.dat=0A 1 arquivo(s) 33.166.874 bytes=0A =0ASo.....w= here is my error?? =0ADoes anyone has any idea??=0A =0AThanks=0AKrownix=0A= =0A=0A=0AYahoo! Search=0AM=FAsica para ver e ouvir: You're Beautiful, do Ja= mes Blunt =0A--------------------------------------------------------------= -----------=0ATake Surveys. Earn Cash. Influence the Future of IT=0AJoin So= urceForge.net's Techsay panel and you'll get the chance to share your=0Aopi= nions on IT & business topics through brief surveys - and earn cash=0Ahttp:= //www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV= =0A_______________________________________________=0ADev-cpp-users mailing = list=0AD...@li...=0ATO UNSUBSCRIBE: http://www23.b= rinkster.com/noicys/devcpp/ub.htm=0Ahttps://lists.sourceforge.net/lists/lis= tinfo/dev-cpp-users=0A=0A=0A=0A=0A=0AVoc=EA quer respostas para suas pergun= tas? Ou voc=EA sabe muito e quer compartilhar seu conhecimento? Experimente= o Yahoo! Respostas!=0A----------------------------------------------------= ---------------------=0ATake Surveys. Earn Cash. Influence the Future of IT= =0AJoin SourceForge.net's Techsay panel and you'll get the chance to share = your=0Aopinions on IT & business topics through brief surveys - and earn ca= sh=0Ahttp://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEVDEV=0A_______________________________________________=0ADev-cpp-users= mailing list=0AD...@li...=0ATO UNSUBSCRIBE: http:= //www23.brinkster.com/noicys/devcpp/ub.htm=0Ahttps://lists.sourceforge.net/= lists/listinfo/dev-cpp-users=0A=0A=0A=09=09=0A_____________________________= __________________________ =0ANovidade no Yahoo! Mail: receba alertas de no= vas mensagens no seu celular. Registre seu aparelho agora! =0Ahttp://br.mob= ile.yahoo.com/mailalertas/ =0A =0A |