Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: stat.cpp
- Revision:
- 0:4ab1392a0142
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stat.cpp Sun Oct 07 11:49:09 2012 +0000
@@ -0,0 +1,22 @@
+#include "stat.h"
+
+int stat(const char *filename, struct stat *buf)
+{
+
+ /*get size*/
+ FILE* fp = 0;
+ fp = fopen(filename,"rb");
+
+ if(fp != 0)
+ {
+ fseek(fp, 0L, SEEK_END);
+ buf->st_size = ftell(fp);
+ fclose(fp);
+ return 0;
+ }
+ else
+ {
+ buf->st_size = 0;
+ return -1;
+ }
+}
\ No newline at end of file