Compare commits
5 Commits
1f54110aa5
...
6816c4eacf
Author | SHA1 | Date |
---|---|---|
ketrptr | 6816c4eacf | |
ketrptr | ac45c8cb65 | |
Jürgen Büchel | aee1ab81a9 | |
Jürgen Büchel | 3612334ffc | |
ketrptr | d794d1c59c |
|
@ -0,0 +1,7 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="StudyPlanner" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" RUN_PATH="$PROJECT_DIR$/Makefile" EXPLICIT_BUILD_TARGET_NAME="all">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
11
src/db.c
11
src/db.c
|
@ -59,11 +59,14 @@ llist *write_csv_to_llist(const char *filename) {
|
|||
fprintf(stderr, "Could not open file %s\n", filename);
|
||||
|
||||
} else {
|
||||
char line[1024]; // Line Buffer
|
||||
char *line = NULL; // Line Buffer
|
||||
size_t nnread, len;
|
||||
int count = 0; // task counter
|
||||
fgets(line, sizeof(line), file); // read and ignore file head
|
||||
getline(&line, &len, file);
|
||||
free(line);
|
||||
line = NULL;
|
||||
|
||||
while (fgets(line, sizeof(line), file)){
|
||||
while ((nnread = getline(&line, &len, file)) != -1) {
|
||||
count++;
|
||||
// remove newline sign
|
||||
line[strcspn(line, "\n")] = '\0';
|
||||
|
@ -96,9 +99,9 @@ llist *write_csv_to_llist(const char *filename) {
|
|||
// Append the task to the linked list
|
||||
llistAppend(list, task);
|
||||
}
|
||||
line = NULL;
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
return list; // null on error
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue