Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to log output from C to the VS command line? #125

Closed
kevinburke opened this issue May 20, 2014 · 4 comments
Closed

How to log output from C to the VS command line? #125

kevinburke opened this issue May 20, 2014 · 4 comments

Comments

@kevinburke
Copy link
Contributor

What is the best way to add print statements and get them to display in Visual Studio? For when you don't necessarily want to set a breakpoint, but do want to inspect some values. Let me know and I'll add it to the wiki.

@atmaxinger
Copy link
Contributor

printf() should work

@kevinburke
Copy link
Contributor Author

Thanks for replying! So, I tried adding a printf("Hello World\n"); line to the code, and toggling a breakpoint at that line. I successfully got the code to stop executing, then pressed "Continue", then checked the "Output" box in VS for output, and didn't see anything.

Am I looking in the wrong place? Is my printf syntax incorrect? I believe the code is executing because I was able to stop execution exactly on that line.

@atmaxinger
Copy link
Contributor

Yeah, sometimes printf() doesn't work (especially in GUI Apps) :(. There's also another Windows specific function called OutputDebugString() http://stackoverflow.com/questions/3009042/how-to-view-printf-output-in-a-win32-application-on-visual-studio-2010

EDIT: Well it appears we can't use printf because OpenRCT2 is a DLL and not an EXE. http://forums.codeguru.com/showthread.php?399253-Console-Outputting-via-printf-from-DLL

OutputDebugString() works (for me at least..)

@kevinburke
Copy link
Contributor Author

Thanks! I updated the wiki.

Kevin Burke
phone: 925.271.7005 | kev.inburke.com

On Tue, May 20, 2014 at 11:06 PM, atmaxinger notifications@github.comwrote:

Yeah, sometimes printf() doesn't work :(. There's also another Windows
specific function called OutputDebugString()
http://stackoverflow.com/questions/3009042/how-to-view-printf-output-in-a-win32-application-on-visual-studio-2010


Reply to this email directly or view it on GitHubhttps://github.com/IntelOrca/OpenRCT2/issues/125#issuecomment-43629809
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants