Compare commits

...

2 Commits

4 changed files with 66 additions and 2 deletions

@ -72,14 +72,14 @@ int main(int argc, char *argv[])
rewind(file);
for (uint i = 0; i < lines; i++) {
char *buffer = NULL;
size_t bufferSize = 0;
if (getline(&buffer, &bufferSize, file) == -1)
break;
sscanf(buffer, "%d %d", &array1[i], &array2[i]);
}
free(buffer);
bufferSize = 0;
fclose(file);
qsort(array1, lines, sizeof(int), compareInt);

38
C_Template/.vscode/launch.json vendored Normal file

@ -0,0 +1,38 @@
{
"configurations": [
{
"name": "Launch with puzzle input",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/CTemplate",
"args": ["../puzzle.input"],
"stopAtEntry": true,
"cwd": "${workspaceFolder}/build/",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build",
},
{
"name": "Launch with test input",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/CTemplate",
"args": ["../test.input"],
"stopAtEntry": true,
"cwd": "${workspaceFolder}/build/",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build",
}
]
}

26
C_Template/.vscode/tasks.json vendored Normal file

@ -0,0 +1,26 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "cmake",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "sh",
"args": [
"-c",
"'mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ..'"
],
},
{
"label": "build",
"type": "shell",
"command": "make",
"options": {
"cwd": "${workspaceRoot}/build"
},
"dependsOn":["cmake"]
}
]
}

0
C_Template/test.input Normal file