Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » FileSize
FileSize [message #52481] Sun, 06 October 2019 22:44 Go to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

do we have a sort of FileSize that return how many byte is a file long?
I am tempted to load the file with LoadFile() and then use GetCount(), but I am afraid to not get the correct result in case of binary file or doing something that can backfire.

Thanks,
Luigi
Re: FileSize [message #52482 is a reply to message #52481] Mon, 07 October 2019 01:23 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Luigi,

The function you are looking for is GetFileLength().

	const char *filepath = "./somedocument.pdf";
	
	DDUMP(GetFileLength(filepath));
	
        // Or
 	FileIn fi(filepath);
	if(fi)  DDUMP(fi.GetSize());

        //Or (this is basically the same as GetFileLength()
  	FindFile ff(filepath);
	if(ff)  DDUMP(ff.GetLength());


Best regards,
Oblivion


Re: FileSize [message #52487 is a reply to message #52482] Mon, 07 October 2019 15:07 Go to previous message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Thanks Oblivion,

I missed all three methods Smile

Luigi
Previous Topic: moveable with assert question
Next Topic: C2280 with Vector
Goto Forum:
  


Current Time: Fri Mar 29 14:09:29 CET 2024

Total time taken to generate the page: 0.01991 seconds