Skip to content

Commit

Permalink
Added example and executable
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptExec committed Dec 19, 2021
1 parent 361ebe3 commit 9f94329
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Usage
```
file_dumper <file list>
```
## Example
```
file_dumper file1.txt file2.txt
```
Binary file added bin/file_dumper.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace stde
{
void export_embed(unsigned char data[], const char* filename, size_t size)
void export_embed(const char* filename, unsigned char data[], size_t size)
{
std::ofstream out(filename, std::ios::binary);
if (out.is_open() and out.good())
Expand Down
7 changes: 7 additions & 0 deletions example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "embed.h"
#include "example_file.bin.cpp"

int main()
{
stde::export_embed("exported.txt", get_embed(example_file, txt), get_embed_size(example_file, txt));
}
6 changes: 6 additions & 0 deletions example_file.txt.bin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
static unsigned char __embed__example_file__txt__[] =
{
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21,
0xd, 0xa, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x44, 0x75, 0x6d, 0x70,
0x65, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65
};
2 changes: 2 additions & 0 deletions exported.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello World!
File Dumper example

0 comments on commit 9f94329

Please sign in to comment.