modify oss to append at end

This commit is contained in:
Robin Müller 2022-07-13 11:25:53 +02:00
parent d1bfc512ec
commit 8b39f65472
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 10 additions and 9 deletions

View File

@ -1,8 +1,8 @@
#include "scratchApi.h"
ReturnValue_t scratch::writeString(std::string name, std::string string) {
std::ostringstream oss;
oss << "xsc_scratch write " << name << " \"" << string << "\"";
std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate);
oss << name << " \"" << string << "\"";
int result = std::system(oss.str().c_str());
if (result != 0) {
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) {
std::ostringstream oss;
oss << "xsc_scratch clear " << key;
std::ostringstream oss("xsc_scratch clear ", std::ostringstream::ate);
oss << key;
int result = std::system(oss.str().c_str());
if (result != 0) {
utility::handleSystemError(result, "scratch::clearValue");

View File

@ -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>
inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
std::ostringstream oss;
oss << "xsc_scratch write " << key << " " << std::to_string(num);
std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate);
oss << key << " " << std::to_string(num);
int result = std::system(oss.str().c_str());
if (result != 0) {
utility::handleSystemError(result, "scratch::writeNumber");

View File

@ -154,9 +154,10 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
ReturnValue_t status = RETURN_OK;
auto oneFileHandler = [&](std::string cmdName) {
fileId = random_string(6);
std::ostringstream oss("/tmp/scex-");
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
oss << cmdName << fileId << ".bin";
fileName = oss.str();
std::cout << fileName << std::endl;
ofstream out(fileName, ofstream::binary);
if (out.bad()) {
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)) {
fileId = random_string(6);
std::ostringstream oss("/tmp/scex-");
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
oss << cmdName << fileId << ".bin";
fileName = oss.str();
fileNameSet = true;

2
tmtc

@ -1 +1 @@
Subproject commit 704357369e6374dc7cf8c88d71fd24bce3b772e0
Subproject commit 0a655f51d4803d5561911101823e611d1f4a19ad