Hi,
I need a help in C++ programming
In program - I want to make empty a log file depending upon its size(eg 10Mb)
![]() |
Hi,
I need a help in C++ programming
In program - I want to make empty a log file depending upon its size(eg 10Mb)
I'm not too familiar with C++, but I have done PHP... I don't recall a file size function. One way to find it might to just to open the file in append mode, and then get the current file pointer. I *think* youn can do that in C, but like I said, I don't program with it.
Look up the stat() command.
I think something like this will work.
Code:#include <sys/stat.h>
#include <sys/types.h>
main()
{
struct stat sbuf;
stat("yourfilenamehere",&sbuf);
printf("Your file is %d bytes\n" sbuf.st_size);
}
Is he a dot or is he a spec? If he's underwater does he get wet, or does the water get him instead? Asterisk man...Quote:
Originally Posted by asterisk_man
All times are GMT -7. The time now is 11:19 PM. |