mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-07-03 11:53:41 +02:00
adding core/file
This commit is contained in:
parent
f84f474290
commit
b88e613b54
3 changed files with 63 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ set (PROGRAM_EXE ${CMAKE_PROJECT_NAME})
|
||||||
|
|
||||||
set (PROGRAM_SOURCE
|
set (PROGRAM_SOURCE
|
||||||
src/console.cpp
|
src/console.cpp
|
||||||
|
src/core/file.cpp
|
||||||
src/core/dictionary.cpp
|
src/core/dictionary.cpp
|
||||||
src/string.cpp
|
src/string.cpp
|
||||||
src/base58.cpp
|
src/base58.cpp
|
||||||
|
|
|
||||||
26
src/core/file.cpp
Normal file
26
src/core/file.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include "file.h"
|
||||||
|
|
||||||
|
namespace eoskeygen {
|
||||||
|
|
||||||
|
bool readLines(const std::string& filename, strlist_t& lines) {
|
||||||
|
|
||||||
|
FILE *fd;
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
|
fd = fopen(filename.c_str(), "r");
|
||||||
|
if (!fd) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(fgets(buf, sizeof(buf), fd) != NULL) {
|
||||||
|
std::string line(buf);
|
||||||
|
lines.push_back(trim(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace eoskeygen
|
||||||
36
src/core/file.h
Normal file
36
src/core/file.h
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019-2020 EOS Sw/eden
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
#ifndef EOSIOKEYGEN_CORE_FILE_H
|
||||||
|
#define EOSIOKEYGEN_CORE_FILE_H
|
||||||
|
|
||||||
|
#include "../string.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace eoskeygen {
|
||||||
|
|
||||||
|
bool readLines(const std::string& filename, strlist_t& lines);
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif /* EOSIOKEYGEN_CORE_FILE_H */
|
||||||
Loading…
Add table
Add a link
Reference in a new issue