-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chaned it to remove quote characters from path and fixed library
- Loading branch information
1 parent
842eefe
commit 4840abc
Showing
4 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include "removeQuotes.h" | ||
|
||
|
||
int containsQuotes(const char* str) { | ||
while (*str != '\0') { | ||
if (*str == '"' || *str == '\'') { | ||
return 1; | ||
} | ||
str++; | ||
} | ||
return 0; | ||
} | ||
|
||
char* removeQuotes(const char* str) { | ||
size_t len = strlen(str); | ||
char* newStr = (char*)malloc(len + 1); // Allocate memory for the modified string | ||
if (newStr == NULL) { | ||
fprintf(stderr, "Memory allocation failed\n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
const char* current = str; // Pointer for iteration | ||
char* newStrPtr = newStr; // Pointer to build the modified string | ||
|
||
while (*current != '\0') { | ||
if (*current != '"' && *current != '\'') { | ||
*newStrPtr = *current; | ||
newStrPtr++; | ||
} | ||
current++; | ||
} | ||
*newStrPtr = '\0'; // Null-terminate the modified string | ||
|
||
return newStr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
int containsQuotes(const char* str); | ||
char *removeQuotes(char* str); |