]>
Commit | Line | Data |
---|---|---|
1 | #ifndef FILEUTILS_H | |
2 | #define FILEUTILS_H | |
3 | /** | |
4 | * @brief Utility function to save data to a file. This method takes a preferred name, but if that | |
5 | * file already exists, it tries with another name until it finds something suitable. | |
6 | * E.g. dumpdata-15.txt | |
7 | * @param preferredName | |
8 | * @param suffix the file suffix. Leave out the ".". | |
9 | * @param data The binary data to write to the file | |
10 | * @param datalen the length of the data | |
11 | * @return 0 for ok, 1 for failz | |
12 | */ | |
13 | int saveFile(const char *preferredName, const char *suffix, const void* data, size_t datalen); | |
14 | ||
15 | ||
16 | /** | |
17 | * Utility function to print to console. This is used consistently within the library instead | |
18 | * of printf, but it actually only calls printf. The reason to have this method is to | |
19 | *make it simple to plug this library into proxmark, which has this function already to | |
20 | * write also to a logfile. When doing so, just point this function to use PrintAndLog | |
21 | * @param fmt | |
22 | */ | |
23 | void prnlog(char *fmt, ...); | |
24 | int fileExists(const char *filename); | |
25 | #endif // FILEUTILS_H |