*
*
****************************************************************************/
+#ifndef ON_DEVICE
#include <stdio.h>
#include <string.h>
/* We should have a valid filename now, e.g. dumpdata-3.bin */
/*Opening file for writing in binary mode*/
- FILE *fh=fopen(fileName,"wb");
- if(!fh) {
- PrintAndLog("Failed to write to file '%s'", fileName);
- free(fh);
+ FILE *f = fopen(fileName,"wb");
+ if (!f) {
+ prnlog("Failed to write to file '%s'", fileName);
+ free(fileName);
return 1;
}
- fwrite(data, 1, datalen, fh);
- fclose(fh);
- PrintAndLog("Saved data to '%s'", fileName);
+ fwrite(data, 1, datalen, f);
+ if (f) {
+ fclose(f);
+ f = NULL;
+ }
+ prnlog("Saved data to '%s'", fileName);
free(fileName);
-
return 0;
}
-int loadFile(const char *fileName, void* data, size_t datalen)
-{
- FILE *filehandle = fopen(fileName, "rb");
- if(!filehandle) {
- PrintAndLog("Failed to read from file '%s'", fileName);
- free(filehandle);
- return 1;
- }
- fread(data,datalen,1,filehandle);
- fclose(filehandle);
- free(filehandle);
- return 0;
-}
/**
* Utility function to print to console. This is used consistently within the library instead
* of printf, but it actually only calls printf (and adds a linebreak).
PrintAndLog(buffer);
}
+#else //if we're on ARM
+void prnlog(char *fmt,...)
+{
+ return;
+}
+
+#endif