-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.c
More file actions
24 lines (23 loc) · 709 Bytes
/
Copy pathutils.c
File metadata and controls
24 lines (23 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "utils.h"
void parseSpace(FILE *file, uint8_t *buffer) {
int pos = 0;
while (fread(&buffer[pos], 1, 1, file) > 0) {//For every character
if (buffer[pos] == ' ') break;//IF the characrter is a space we are done
if (buffer[pos] == '\n') {//If the line ends here
if (pos > 0) break;//if we are not at the beginning of the line
else {//if it's an empty line
pos = 0;//reset buffer write position
continue;//finish this loop iteration
};
} else {
pos++;
}
//printf("%d %c", buffer[pos], buffer[pos]);
if (pos>=2 && buffer[pos-1]=='/' && buffer[pos-2]=='/') {//Skip comments
//printf("Comment detected\n");
skipLine(file);
pos = 0;
}
}
buffer[pos] = '\0';
}