From 55c0c3c01b00661eae8a0fd665de98039ae185d8 Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Wed, 4 Oct 2023 17:04:55 +0200
Subject: [PATCH] Fix multiple reads from single input line

---
 src/sphere/edfb.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/sphere/edfb.cpp b/src/sphere/edfb.cpp
index 574c089e..9ca373da 100644
--- a/src/sphere/edfb.cpp
+++ b/src/sphere/edfb.cpp
@@ -361,7 +361,10 @@ int main(int argc, char **argv) {
   last_read_line++;
   iog = new int[nsph];
   for (int i = 0; i < nsph; i++) {
-    sscanf(file_lines[last_read_line].c_str(), " %d", (iog + i));
+    string read_format = "";
+    for (int j = 0; j < i; j++) read_format += " %*d";
+    read_format += " %d";
+    sscanf(file_lines[last_read_line].c_str(), read_format.c_str(), (iog + i));
   }
   nshl = new int[nsph];
   ros = new double[nsph];
-- 
GitLab