From a4c843e3e2b615e6717a100698d7615cea8d18fb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 6 Jul 2021 11:28:58 +0200 Subject: [PATCH] REAMDE update --- README.md | 13 +++++++++++++ bsp_q7s/boardtest/Q7STestTask.cpp | 19 +++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 98d1046a..63d00b19 100644 --- a/README.md +++ b/README.md @@ -578,6 +578,19 @@ Eclipse indexer. # Q7S Utilities +## Creating files with cat and echo + +The only folder which can be written in the root filesystem is the `tmp` folder. + +You can create a simple file with initial content with `echo` + +```sh +echo "Hallo Welt" > /tmp/test.txt +cat /tmp/test.txt +``` + +For more useful combinations, see this [link](https://www.freecodecamp.org/news/the-cat-command-in-linux-how-to-create-a-text-file-with-cat-or-touch/). + ## Libgpiod Detect all gpio device files: diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 0166bfb8..55aa7657 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -16,17 +16,20 @@ ReturnValue_t Q7STestTask::performOneShotAction() { void Q7STestTask::sdCardTests() { using namespace std; Stopwatch stopwatch; - FILE* testFile = popen("q7hw sd info all > /tmp/sd_status.txt", "r"); - TaskFactory::delayTask(3000); + ofstream testFile("/tmp/test.txt"); + testFile << "Hallo Welt" << endl; + testFile.close(); + //FILE* testFile = popen("q7hw sd info all", "r"); + //TaskFactory::delayTask(3000); //int result = system(); //std::fstream fs(testFile); // Read contents from file - char* line = nullptr; - size_t len = 0; - ssize_t read = getline(&line, &len, testFile); - if(read != -1 and line != nullptr) { - cout << line << endl; - } +// char* line = nullptr; +// size_t len = 0; +// ssize_t read = getline(&line, &len, testFile); +// if(read != -1 and line != nullptr) { +// cout << line << endl; +// } // c = fgetc(testFile); // while (c != EOF) // {