From 62c7f660566f82195c7aef935c0576e3ce4347f9 Mon Sep 17 00:00:00 2001 From: Ollie <oliver2.beard@live.uwe.ac.uk> Date: Tue, 8 Apr 2025 14:40:54 +0000 Subject: [PATCH] Update file cli.c --- Worksheet 1/Part 1/Code/cli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Worksheet 1/Part 1/Code/cli.c b/Worksheet 1/Part 1/Code/cli.c index bd86dfc..08c7f56 100644 --- a/Worksheet 1/Part 1/Code/cli.c +++ b/Worksheet 1/Part 1/Code/cli.c @@ -50,8 +50,10 @@ void execute_command(char *command) { size_t length = atoi(token); //Prepare the buffer and execute the read operation - uint8_t buffer[length]; + uint8_t buffer[length + 1]; flash_read_safe(address, buffer, length); + buffer[length] = '\0'; + printf("\nData: %s\n", buffer); //Output the read data printf("\nData: %s\n", buffer); -- GitLab