Skip to content

Commit

Permalink
Fixed so 'easy' mode lets path have spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Black-Speedy committed Jan 10, 2024
1 parent 32281df commit ac43cc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions WebShare-Connect/WebShare-Connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ int main(int argc, char const* argv[])
//}
} while (error != 1);

int c;
while ((c = getchar()) != '\n' && c != EOF);
printf("Please enter the file path: ");
error = scanf("%255s", filePath);
fgets(filePath, 256, stdin);
filePath[strcspn(filePath, "\n")] = 0; // Remove trailing newline

user_argv[0] = strdup(argv[0]); // Program name
user_argv[1] = strdup(mode);
Expand All @@ -92,7 +95,6 @@ int main(int argc, char const* argv[])
else user_argv[4] = strdup(filePath);

if (strcmp(mode, "sender") == 0) {

return sender_main(4, user_argv + 1); // 4 is the number of arguments in user_argv
}
else {
Expand Down

0 comments on commit ac43cc5

Please sign in to comment.