modify oss to append at end
This commit is contained in:
parent
d1bfc512ec
commit
8b39f65472
@ -1,8 +1,8 @@
|
|||||||
#include "scratchApi.h"
|
#include "scratchApi.h"
|
||||||
|
|
||||||
ReturnValue_t scratch::writeString(std::string name, std::string string) {
|
ReturnValue_t scratch::writeString(std::string name, std::string string) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate);
|
||||||
oss << "xsc_scratch write " << name << " \"" << string << "\"";
|
oss << name << " \"" << string << "\"";
|
||||||
int result = std::system(oss.str().c_str());
|
int result = std::system(oss.str().c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "scratch::writeString");
|
utility::handleSystemError(result, "scratch::writeString");
|
||||||
@ -39,8 +39,8 @@ ReturnValue_t scratch::readString(std::string key, std::string &string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t scratch::clearValue(std::string key) {
|
ReturnValue_t scratch::clearValue(std::string key) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss("xsc_scratch clear ", std::ostringstream::ate);
|
||||||
oss << "xsc_scratch clear " << key;
|
oss << key;
|
||||||
int result = std::system(oss.str().c_str());
|
int result = std::system(oss.str().c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "scratch::clearValue");
|
utility::handleSystemError(result, "scratch::clearValue");
|
||||||
|
@ -94,8 +94,8 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
|
|||||||
|
|
||||||
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||||
inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
|
inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate);
|
||||||
oss << "xsc_scratch write " << key << " " << std::to_string(num);
|
oss << key << " " << std::to_string(num);
|
||||||
int result = std::system(oss.str().c_str());
|
int result = std::system(oss.str().c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "scratch::writeNumber");
|
utility::handleSystemError(result, "scratch::writeNumber");
|
||||||
|
@ -154,9 +154,10 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
ReturnValue_t status = RETURN_OK;
|
ReturnValue_t status = RETURN_OK;
|
||||||
auto oneFileHandler = [&](std::string cmdName) {
|
auto oneFileHandler = [&](std::string cmdName) {
|
||||||
fileId = random_string(6);
|
fileId = random_string(6);
|
||||||
std::ostringstream oss("/tmp/scex-");
|
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
|
||||||
oss << cmdName << fileId << ".bin";
|
oss << cmdName << fileId << ".bin";
|
||||||
fileName = oss.str();
|
fileName = oss.str();
|
||||||
|
std::cout << fileName << std::endl;
|
||||||
ofstream out(fileName, ofstream::binary);
|
ofstream out(fileName, ofstream::binary);
|
||||||
if (out.bad()) {
|
if (out.bad()) {
|
||||||
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
||||||
@ -172,7 +173,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
||||||
|
|
||||||
fileId = random_string(6);
|
fileId = random_string(6);
|
||||||
std::ostringstream oss("/tmp/scex-");
|
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
|
||||||
oss << cmdName << fileId << ".bin";
|
oss << cmdName << fileId << ".bin";
|
||||||
fileName = oss.str();
|
fileName = oss.str();
|
||||||
fileNameSet = true;
|
fileNameSet = true;
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 704357369e6374dc7cf8c88d71fd24bce3b772e0
|
Subproject commit 0a655f51d4803d5561911101823e611d1f4a19ad
|
Loading…
x
Reference in New Issue
Block a user