From 0c128ccda3fbb75522d317649917f695f0cf5ef1 Mon Sep 17 00:00:00 2001 From: Bladen Martin Date: Thu, 28 May 2020 22:24:18 +0530 Subject: automate the writing of IP and port to the common_ip_file --- src/model_generation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/model_generation.py b/src/model_generation.py index da8e272..dcb0788 100644 --- a/src/model_generation.py +++ b/src/model_generation.py @@ -268,7 +268,8 @@ class ModelGeneration: if (fptr) { char line[20]; - while(fscanf(fptr, "%s", line) == 1) { + int line_port; + while(fscanf(fptr, "%s %d\\n", line, &line_port) == 2) { ip_count++; } @@ -284,7 +285,7 @@ class ModelGeneration: fptr = fopen(ip_filename, "a"); if (fptr) { - fprintf(fptr, "%s\\n", my_ip); + fprintf(fptr, "%s %d\\n", my_ip, sock_port); fclose(fptr); } else { perror("Client - cannot open Common_IP file "); -- cgit