|
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
1. How to get the Filesize #2647 Posted by: HeReSY 2003-09-19 16:54:20 |
Hi,
anybody an answer of this question. I only found functions to create, close, open, read and write files, but i didn't find a function which returns the size of a file.
HeReSY |
2. Re: How to get the Filesize #2648 |
Try wxStat(), it's a wrapper of stat(). |
3. Re: How to get the Filesize #2714 Posted by: 2003-10-08 18:23:46 |
I had the same problem. I solved it with open the file, and the Returncode of SeekEnd tells the position.
stat / wxStat seems to be better, but could not find ANYTHING in the documentation. is it an undocumentet wxFile function? Any more information could be helpful! Thank's Markus |
4. Re: How to get the Filesize #2716 |
stat is a standard function in libc, document: http://g.yi.org/f.php?f=2853#2968
wxWindows wrapped many standard functions to better interface with wxWindows, for instance, with wxString, unicode, etc. You can search header files in include directory for their definitions. |
5. Re: How to get the Filesize #2724 Posted by: HeReSY 2003-10-10 09:50:49 |
I have made it with wxFileInputStream. The Base class has the member function GetSize() and it works goog.
HeReSY |
6. Re: How to get the Filesize #2725 Posted by: 2003-10-10 14:57:31 |
simple but good AND the file does not need to be opened like in the other solutions:
wxStructStat buf; int result,size; wxString cur_file; .... result = wxStat( cur_file, &buf ); if (result != 0 ) size = -1; // file is unknown => has no size else size = buf.st_size;
|
7. Re: How to get the Filesize #2727 Posted by: HeReSY 2003-10-10 18:35:37 |
Which header do i have to include. I included the filefn.h where wxStat is declared, but the compiler says, that he did'nt no such function.
HeReSY |
8. Re: How to get the Filesize #2729 Posted by: 2003-10-10 19:04:26 |
I see, the filefn does not include everything, it needs. #include <sys/stat.h> ... should help, in my systems it compiles with GCC and Visual C++ Markus |
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |