morty41
morty41

Reputation: 19

How to save C program output?

I have compiled and run this C program to read the data from a MPPT solar charge controller, connected to a raspberry pi.

https://github.com/anschoewe/morningstar-sunsaver-mppt#readme

I can read all the data no problem, but when i run either of the following commands to save the data I get a 'no such file or directory' message.

./sunsaver > output/snapshot_$(date +%Y-%m-%d_%H-%M-%S)

./sunsaver > output/logs_$(date +%Y-%m-%d_%H-%M-%S)

Do I need to create a file or directory to save to ? and if so where?

Thanks in advance

Upvotes: 0

Views: 79

Answers (1)

P.P
P.P

Reputation: 121357

Output redirection (>) doesn't create directories. So yes, you need to create output directory yourself:

mkdir -p output

Upvotes: 2

Related Questions