For C, how can Visual Studio-2017 debug a code that reads a text file and prints output following that text file?Why is “while (!feof(file))” always wrong?Should I add the Visual Studio .suo and .user files to source control?How to run Visual Studio post-build events for debug build onlyDebugging with command-line parameters in Visual StudioHow do I add an existing directory tree to a project in Visual Studio?How do you count the lines of code in a Visual Studio solution?How to read a file line-by-line into a list?How do you auto format code in Visual Studio?Writing to output window of Visual Studio?Can you force Visual Studio to always run as an Administrator in Windows 8?Compare two files in Visual Studio
WTB Horizon 47c - small crack in the middle of the tire
What is /bin/red
Through: how to use it with subtraction of functions?
How do native German speakers usually express skepticism (using even) about a premise?
Did the Ottoman empire suppress the printing press?
Reverse dots and boxes
Swapping "Good" and "Bad"
What are the indigenous English words for a prostitute?
Postgres trigram match acting strange for specific characters
When I press the space bar it deletes the letters in front of it
How to tell someone I'd like to become friends without letting them think I'm romantically interested in them?
Why do you use the "park" gear to park a car and not only the handbrake?
How do we handle pauses in a dialogue?
Found and corrected a mistake on someone's else paper -- praxis?
Matrix with arrows and comments
What is the minimum time required for final wash in film development?
Data Encryption by Application vs Data Encryption in Database
What the real concept of Static keyword in perspective of Embedded C. See below code
Party going through airport security at separate times?
The three greedy pirates
What are some further readings in Econometrics you recommend?
The joke office
Why different specifications for telescopes and binoculars?
Distinguish the explanations of Galadriel's test in LotR
For C, how can Visual Studio-2017 debug a code that reads a text file and prints output following that text file?
Why is “while (!feof(file))” always wrong?Should I add the Visual Studio .suo and .user files to source control?How to run Visual Studio post-build events for debug build onlyDebugging with command-line parameters in Visual StudioHow do I add an existing directory tree to a project in Visual Studio?How do you count the lines of code in a Visual Studio solution?How to read a file line-by-line into a list?How do you auto format code in Visual Studio?Writing to output window of Visual Studio?Can you force Visual Studio to always run as an Administrator in Windows 8?Compare two files in Visual Studio
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a C code that opens and reads a text file with numbers then computes the area of a rectangle using those numbers.
My Code is:
#include <stdio.h>
int main()
FILE *ifile;
float length, width;
float maxarea = 0, maxlen, maxwidth;
ifile = fopen("rectangles.txt", "r");
while (feof(ifile) <= 0)
fscanf(ifile, "%f %f", &length, &width);
if (length * width > maxarea)
maxarea = length * width;
maxlen = length;
maxwidth = width;
printf("Maximum area is %f for rectangle with length %f and width %f",
maxarea, maxlen, maxwidth);
fclose(ifile);
return(0);
When I debug it this shows up:
When I retry it it shows this error:
With the same code when I run it on a Linux Terminal it works and gives the right output. (recLarge is the executable file)
How can I get the same output on Visual Studio 2017?
c visual-studio file visual-studio-2017
add a comment |
I have a C code that opens and reads a text file with numbers then computes the area of a rectangle using those numbers.
My Code is:
#include <stdio.h>
int main()
FILE *ifile;
float length, width;
float maxarea = 0, maxlen, maxwidth;
ifile = fopen("rectangles.txt", "r");
while (feof(ifile) <= 0)
fscanf(ifile, "%f %f", &length, &width);
if (length * width > maxarea)
maxarea = length * width;
maxlen = length;
maxwidth = width;
printf("Maximum area is %f for rectangle with length %f and width %f",
maxarea, maxlen, maxwidth);
fclose(ifile);
return(0);
When I debug it this shows up:
When I retry it it shows this error:
With the same code when I run it on a Linux Terminal it works and gives the right output. (recLarge is the executable file)
How can I get the same output on Visual Studio 2017?
c visual-studio file visual-studio-2017
You just debug it like you usually would. Why you can't isn't very clear. If it isn't finding the file, be sure to set the working directory in the project debug options.
– Retired Ninja
Mar 26 at 0:52
You should probably read stackoverflow.com/questions/5431941/… too.
– Retired Ninja
Mar 26 at 0:55
@RetiredNinja why does feof work when I run the code on a Linux terminal but doesn't work and gives seg fault when it's on Visual Studio 2017?
– Su.she
Mar 26 at 1:45
You cannot continue running the program from that point.
– Antti Haapala
Apr 1 at 9:02
add a comment |
I have a C code that opens and reads a text file with numbers then computes the area of a rectangle using those numbers.
My Code is:
#include <stdio.h>
int main()
FILE *ifile;
float length, width;
float maxarea = 0, maxlen, maxwidth;
ifile = fopen("rectangles.txt", "r");
while (feof(ifile) <= 0)
fscanf(ifile, "%f %f", &length, &width);
if (length * width > maxarea)
maxarea = length * width;
maxlen = length;
maxwidth = width;
printf("Maximum area is %f for rectangle with length %f and width %f",
maxarea, maxlen, maxwidth);
fclose(ifile);
return(0);
When I debug it this shows up:
When I retry it it shows this error:
With the same code when I run it on a Linux Terminal it works and gives the right output. (recLarge is the executable file)
How can I get the same output on Visual Studio 2017?
c visual-studio file visual-studio-2017
I have a C code that opens and reads a text file with numbers then computes the area of a rectangle using those numbers.
My Code is:
#include <stdio.h>
int main()
FILE *ifile;
float length, width;
float maxarea = 0, maxlen, maxwidth;
ifile = fopen("rectangles.txt", "r");
while (feof(ifile) <= 0)
fscanf(ifile, "%f %f", &length, &width);
if (length * width > maxarea)
maxarea = length * width;
maxlen = length;
maxwidth = width;
printf("Maximum area is %f for rectangle with length %f and width %f",
maxarea, maxlen, maxwidth);
fclose(ifile);
return(0);
When I debug it this shows up:
When I retry it it shows this error:
With the same code when I run it on a Linux Terminal it works and gives the right output. (recLarge is the executable file)
How can I get the same output on Visual Studio 2017?
c visual-studio file visual-studio-2017
c visual-studio file visual-studio-2017
edited Mar 26 at 3:43
Su.she
asked Mar 26 at 0:38
Su.sheSu.she
256 bronze badges
256 bronze badges
You just debug it like you usually would. Why you can't isn't very clear. If it isn't finding the file, be sure to set the working directory in the project debug options.
– Retired Ninja
Mar 26 at 0:52
You should probably read stackoverflow.com/questions/5431941/… too.
– Retired Ninja
Mar 26 at 0:55
@RetiredNinja why does feof work when I run the code on a Linux terminal but doesn't work and gives seg fault when it's on Visual Studio 2017?
– Su.she
Mar 26 at 1:45
You cannot continue running the program from that point.
– Antti Haapala
Apr 1 at 9:02
add a comment |
You just debug it like you usually would. Why you can't isn't very clear. If it isn't finding the file, be sure to set the working directory in the project debug options.
– Retired Ninja
Mar 26 at 0:52
You should probably read stackoverflow.com/questions/5431941/… too.
– Retired Ninja
Mar 26 at 0:55
@RetiredNinja why does feof work when I run the code on a Linux terminal but doesn't work and gives seg fault when it's on Visual Studio 2017?
– Su.she
Mar 26 at 1:45
You cannot continue running the program from that point.
– Antti Haapala
Apr 1 at 9:02
You just debug it like you usually would. Why you can't isn't very clear. If it isn't finding the file, be sure to set the working directory in the project debug options.
– Retired Ninja
Mar 26 at 0:52
You just debug it like you usually would. Why you can't isn't very clear. If it isn't finding the file, be sure to set the working directory in the project debug options.
– Retired Ninja
Mar 26 at 0:52
You should probably read stackoverflow.com/questions/5431941/… too.
– Retired Ninja
Mar 26 at 0:55
You should probably read stackoverflow.com/questions/5431941/… too.
– Retired Ninja
Mar 26 at 0:55
@RetiredNinja why does feof work when I run the code on a Linux terminal but doesn't work and gives seg fault when it's on Visual Studio 2017?
– Su.she
Mar 26 at 1:45
@RetiredNinja why does feof work when I run the code on a Linux terminal but doesn't work and gives seg fault when it's on Visual Studio 2017?
– Su.she
Mar 26 at 1:45
You cannot continue running the program from that point.
– Antti Haapala
Apr 1 at 9:02
You cannot continue running the program from that point.
– Antti Haapala
Apr 1 at 9:02
add a comment |
2 Answers
2
active
oldest
votes
Edit your project settings and add any command-line options to Command Arguments
:
Pay attention to the Working Directory
setting.
Obviously, your main
function is not currently set up for this. You need to add support for arguments:
int main(int argc, char **argv)
if (argc <= 1)
fprintf(stderr, "Not enough argumentsn");
return EXIT_FAILURE;
char *filename = argv[1];
FILE *ifile = fopen(filename,"r");
if (!file)
perror("Cannot open file");
return EXIT_FAILURE;
// ...
return EXIT_SUCCESS;
that was a corrected code provided by my professor tho. Is it impossible to compile it with the original code ?
– Su.she
Mar 26 at 1:26
No, you can use the other code. It's becoming difficult to interpret your question though. Maybe you need to be specific about exactly what it is you're trying to achieve. In the question that I was answering, it appeared that you were asking how to supply command-line arguments to a program that is run from the Visual Studio IDE with (or without) the debugger attached.
– paddy
Mar 26 at 1:28
yes that's exactly it!! I know how to get the output from a linux terminal(I am using MobaXTerm) but don't know how to make it work on Visual Studio. I can't find any command line on Visual Studio.
– Su.she
Mar 26 at 1:48
1
You are not helping to clarify your position. What specifically is "exactly it"? Did I interpret your question correctly? In that case, I answered it. If something about your current program does not work for you, please clarify. You want to debug your program by running it from Visual Studio, so in that case, you can affect any command line options or starting directory from the Project Properties as I described. If you want to run it manually from the command line, then do that from the command prompt. Beyond this, I struggle to offer advice because your requirements are vague.
– paddy
Mar 26 at 2:47
Since I couldn't explain it well I edited my original question and added screenshots. Does it maybe make my question a little more clear??
– Su.she
Mar 26 at 3:46
|
show 2 more comments
I needed to create the text file "rectangles.txt" under resources as a text file. The main C code will be under source. The dubugging for the code needs to have rectangles.txt as the command argument. Compile as should be Compile as C code(/TC).
No, this is not needed - it is just important that therectangles.txt
be in the same folder.
– Antti Haapala
Apr 1 at 9:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348293%2ffor-c-how-can-visual-studio-2017-debug-a-code-that-reads-a-text-file-and-prints%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Edit your project settings and add any command-line options to Command Arguments
:
Pay attention to the Working Directory
setting.
Obviously, your main
function is not currently set up for this. You need to add support for arguments:
int main(int argc, char **argv)
if (argc <= 1)
fprintf(stderr, "Not enough argumentsn");
return EXIT_FAILURE;
char *filename = argv[1];
FILE *ifile = fopen(filename,"r");
if (!file)
perror("Cannot open file");
return EXIT_FAILURE;
// ...
return EXIT_SUCCESS;
that was a corrected code provided by my professor tho. Is it impossible to compile it with the original code ?
– Su.she
Mar 26 at 1:26
No, you can use the other code. It's becoming difficult to interpret your question though. Maybe you need to be specific about exactly what it is you're trying to achieve. In the question that I was answering, it appeared that you were asking how to supply command-line arguments to a program that is run from the Visual Studio IDE with (or without) the debugger attached.
– paddy
Mar 26 at 1:28
yes that's exactly it!! I know how to get the output from a linux terminal(I am using MobaXTerm) but don't know how to make it work on Visual Studio. I can't find any command line on Visual Studio.
– Su.she
Mar 26 at 1:48
1
You are not helping to clarify your position. What specifically is "exactly it"? Did I interpret your question correctly? In that case, I answered it. If something about your current program does not work for you, please clarify. You want to debug your program by running it from Visual Studio, so in that case, you can affect any command line options or starting directory from the Project Properties as I described. If you want to run it manually from the command line, then do that from the command prompt. Beyond this, I struggle to offer advice because your requirements are vague.
– paddy
Mar 26 at 2:47
Since I couldn't explain it well I edited my original question and added screenshots. Does it maybe make my question a little more clear??
– Su.she
Mar 26 at 3:46
|
show 2 more comments
Edit your project settings and add any command-line options to Command Arguments
:
Pay attention to the Working Directory
setting.
Obviously, your main
function is not currently set up for this. You need to add support for arguments:
int main(int argc, char **argv)
if (argc <= 1)
fprintf(stderr, "Not enough argumentsn");
return EXIT_FAILURE;
char *filename = argv[1];
FILE *ifile = fopen(filename,"r");
if (!file)
perror("Cannot open file");
return EXIT_FAILURE;
// ...
return EXIT_SUCCESS;
that was a corrected code provided by my professor tho. Is it impossible to compile it with the original code ?
– Su.she
Mar 26 at 1:26
No, you can use the other code. It's becoming difficult to interpret your question though. Maybe you need to be specific about exactly what it is you're trying to achieve. In the question that I was answering, it appeared that you were asking how to supply command-line arguments to a program that is run from the Visual Studio IDE with (or without) the debugger attached.
– paddy
Mar 26 at 1:28
yes that's exactly it!! I know how to get the output from a linux terminal(I am using MobaXTerm) but don't know how to make it work on Visual Studio. I can't find any command line on Visual Studio.
– Su.she
Mar 26 at 1:48
1
You are not helping to clarify your position. What specifically is "exactly it"? Did I interpret your question correctly? In that case, I answered it. If something about your current program does not work for you, please clarify. You want to debug your program by running it from Visual Studio, so in that case, you can affect any command line options or starting directory from the Project Properties as I described. If you want to run it manually from the command line, then do that from the command prompt. Beyond this, I struggle to offer advice because your requirements are vague.
– paddy
Mar 26 at 2:47
Since I couldn't explain it well I edited my original question and added screenshots. Does it maybe make my question a little more clear??
– Su.she
Mar 26 at 3:46
|
show 2 more comments
Edit your project settings and add any command-line options to Command Arguments
:
Pay attention to the Working Directory
setting.
Obviously, your main
function is not currently set up for this. You need to add support for arguments:
int main(int argc, char **argv)
if (argc <= 1)
fprintf(stderr, "Not enough argumentsn");
return EXIT_FAILURE;
char *filename = argv[1];
FILE *ifile = fopen(filename,"r");
if (!file)
perror("Cannot open file");
return EXIT_FAILURE;
// ...
return EXIT_SUCCESS;
Edit your project settings and add any command-line options to Command Arguments
:
Pay attention to the Working Directory
setting.
Obviously, your main
function is not currently set up for this. You need to add support for arguments:
int main(int argc, char **argv)
if (argc <= 1)
fprintf(stderr, "Not enough argumentsn");
return EXIT_FAILURE;
char *filename = argv[1];
FILE *ifile = fopen(filename,"r");
if (!file)
perror("Cannot open file");
return EXIT_FAILURE;
// ...
return EXIT_SUCCESS;
answered Mar 26 at 0:57
paddypaddy
44.6k5 gold badges39 silver badges79 bronze badges
44.6k5 gold badges39 silver badges79 bronze badges
that was a corrected code provided by my professor tho. Is it impossible to compile it with the original code ?
– Su.she
Mar 26 at 1:26
No, you can use the other code. It's becoming difficult to interpret your question though. Maybe you need to be specific about exactly what it is you're trying to achieve. In the question that I was answering, it appeared that you were asking how to supply command-line arguments to a program that is run from the Visual Studio IDE with (or without) the debugger attached.
– paddy
Mar 26 at 1:28
yes that's exactly it!! I know how to get the output from a linux terminal(I am using MobaXTerm) but don't know how to make it work on Visual Studio. I can't find any command line on Visual Studio.
– Su.she
Mar 26 at 1:48
1
You are not helping to clarify your position. What specifically is "exactly it"? Did I interpret your question correctly? In that case, I answered it. If something about your current program does not work for you, please clarify. You want to debug your program by running it from Visual Studio, so in that case, you can affect any command line options or starting directory from the Project Properties as I described. If you want to run it manually from the command line, then do that from the command prompt. Beyond this, I struggle to offer advice because your requirements are vague.
– paddy
Mar 26 at 2:47
Since I couldn't explain it well I edited my original question and added screenshots. Does it maybe make my question a little more clear??
– Su.she
Mar 26 at 3:46
|
show 2 more comments
that was a corrected code provided by my professor tho. Is it impossible to compile it with the original code ?
– Su.she
Mar 26 at 1:26
No, you can use the other code. It's becoming difficult to interpret your question though. Maybe you need to be specific about exactly what it is you're trying to achieve. In the question that I was answering, it appeared that you were asking how to supply command-line arguments to a program that is run from the Visual Studio IDE with (or without) the debugger attached.
– paddy
Mar 26 at 1:28
yes that's exactly it!! I know how to get the output from a linux terminal(I am using MobaXTerm) but don't know how to make it work on Visual Studio. I can't find any command line on Visual Studio.
– Su.she
Mar 26 at 1:48
1
You are not helping to clarify your position. What specifically is "exactly it"? Did I interpret your question correctly? In that case, I answered it. If something about your current program does not work for you, please clarify. You want to debug your program by running it from Visual Studio, so in that case, you can affect any command line options or starting directory from the Project Properties as I described. If you want to run it manually from the command line, then do that from the command prompt. Beyond this, I struggle to offer advice because your requirements are vague.
– paddy
Mar 26 at 2:47
Since I couldn't explain it well I edited my original question and added screenshots. Does it maybe make my question a little more clear??
– Su.she
Mar 26 at 3:46
that was a corrected code provided by my professor tho. Is it impossible to compile it with the original code ?
– Su.she
Mar 26 at 1:26
that was a corrected code provided by my professor tho. Is it impossible to compile it with the original code ?
– Su.she
Mar 26 at 1:26
No, you can use the other code. It's becoming difficult to interpret your question though. Maybe you need to be specific about exactly what it is you're trying to achieve. In the question that I was answering, it appeared that you were asking how to supply command-line arguments to a program that is run from the Visual Studio IDE with (or without) the debugger attached.
– paddy
Mar 26 at 1:28
No, you can use the other code. It's becoming difficult to interpret your question though. Maybe you need to be specific about exactly what it is you're trying to achieve. In the question that I was answering, it appeared that you were asking how to supply command-line arguments to a program that is run from the Visual Studio IDE with (or without) the debugger attached.
– paddy
Mar 26 at 1:28
yes that's exactly it!! I know how to get the output from a linux terminal(I am using MobaXTerm) but don't know how to make it work on Visual Studio. I can't find any command line on Visual Studio.
– Su.she
Mar 26 at 1:48
yes that's exactly it!! I know how to get the output from a linux terminal(I am using MobaXTerm) but don't know how to make it work on Visual Studio. I can't find any command line on Visual Studio.
– Su.she
Mar 26 at 1:48
1
1
You are not helping to clarify your position. What specifically is "exactly it"? Did I interpret your question correctly? In that case, I answered it. If something about your current program does not work for you, please clarify. You want to debug your program by running it from Visual Studio, so in that case, you can affect any command line options or starting directory from the Project Properties as I described. If you want to run it manually from the command line, then do that from the command prompt. Beyond this, I struggle to offer advice because your requirements are vague.
– paddy
Mar 26 at 2:47
You are not helping to clarify your position. What specifically is "exactly it"? Did I interpret your question correctly? In that case, I answered it. If something about your current program does not work for you, please clarify. You want to debug your program by running it from Visual Studio, so in that case, you can affect any command line options or starting directory from the Project Properties as I described. If you want to run it manually from the command line, then do that from the command prompt. Beyond this, I struggle to offer advice because your requirements are vague.
– paddy
Mar 26 at 2:47
Since I couldn't explain it well I edited my original question and added screenshots. Does it maybe make my question a little more clear??
– Su.she
Mar 26 at 3:46
Since I couldn't explain it well I edited my original question and added screenshots. Does it maybe make my question a little more clear??
– Su.she
Mar 26 at 3:46
|
show 2 more comments
I needed to create the text file "rectangles.txt" under resources as a text file. The main C code will be under source. The dubugging for the code needs to have rectangles.txt as the command argument. Compile as should be Compile as C code(/TC).
No, this is not needed - it is just important that therectangles.txt
be in the same folder.
– Antti Haapala
Apr 1 at 9:02
add a comment |
I needed to create the text file "rectangles.txt" under resources as a text file. The main C code will be under source. The dubugging for the code needs to have rectangles.txt as the command argument. Compile as should be Compile as C code(/TC).
No, this is not needed - it is just important that therectangles.txt
be in the same folder.
– Antti Haapala
Apr 1 at 9:02
add a comment |
I needed to create the text file "rectangles.txt" under resources as a text file. The main C code will be under source. The dubugging for the code needs to have rectangles.txt as the command argument. Compile as should be Compile as C code(/TC).
I needed to create the text file "rectangles.txt" under resources as a text file. The main C code will be under source. The dubugging for the code needs to have rectangles.txt as the command argument. Compile as should be Compile as C code(/TC).
edited Apr 1 at 8:56
marc_s
596k135 gold badges1143 silver badges1281 bronze badges
596k135 gold badges1143 silver badges1281 bronze badges
answered Mar 27 at 4:05
Su.sheSu.she
256 bronze badges
256 bronze badges
No, this is not needed - it is just important that therectangles.txt
be in the same folder.
– Antti Haapala
Apr 1 at 9:02
add a comment |
No, this is not needed - it is just important that therectangles.txt
be in the same folder.
– Antti Haapala
Apr 1 at 9:02
No, this is not needed - it is just important that the
rectangles.txt
be in the same folder.– Antti Haapala
Apr 1 at 9:02
No, this is not needed - it is just important that the
rectangles.txt
be in the same folder.– Antti Haapala
Apr 1 at 9:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348293%2ffor-c-how-can-visual-studio-2017-debug-a-code-that-reads-a-text-file-and-prints%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You just debug it like you usually would. Why you can't isn't very clear. If it isn't finding the file, be sure to set the working directory in the project debug options.
– Retired Ninja
Mar 26 at 0:52
You should probably read stackoverflow.com/questions/5431941/… too.
– Retired Ninja
Mar 26 at 0:55
@RetiredNinja why does feof work when I run the code on a Linux terminal but doesn't work and gives seg fault when it's on Visual Studio 2017?
– Su.she
Mar 26 at 1:45
You cannot continue running the program from that point.
– Antti Haapala
Apr 1 at 9:02