I'm trying to debug my code in VS Code. When I "Run" the code (the button on the top right corner or Ctrl+Alt+N) it works perfectly. But when I try debug, the code goes to the flow==NULL option.
Here is my reading function from code:
AVLTree readData(char* file_name){
AVLTree myTree;
myTree = CreateTree();
/* Opening file stream for reading data from the file */
FILE* flow;
flow = fopen(file_name,"r");
if(flow==NULL){
printf("
flow == NULL option
");
printf("File Error"); exit(1);
}
else{
printf("File opened successfully
");
}
Also here is my launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "gcc.exe - Etkin dosyay? derle ve dosyada hata ay?kla",
"type": "cppdbg",
"request": "launch",
// "program": "${fileDirname}\${fileBasenameNoExtension}.exe",
"program": "${fileDirname}\indexingphotos.exe",
"args": [],
"stopAtEntry": false,
"cwd": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gdb.exe",
"setupCommands": [
{
"description": "gdb i?in düzgün yazd?rmay? etkinle?tir",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe etkin dosyay? derle"
}
]
}
What should I do?
Also, I'm a computer engineering student and I worked with Dev C++ until now. I'm trying to switch to VS CODE, but it seems too confusing than Dev C++. How can I learn to use VS Code (or another modern IDE) any suggestions?
question from:https://stackoverflow.com/questions/66047895/vs-code-debugging-issue-when-reading-data-from-a-file-in-c