![]() |
System.out.println help
Hello, I am trying to get my encoder value to print to the net console.
The only line giving me an error is. System.out.println(encoder1.Get()); the error console says System is not defined. Any help would be appreciated. |
Re: System.out.println help
Try this instead:
Code:
printf("Encoder1=%d", encoder1.Get()); |
Re: System.out.println help
Judging by the use of a capital in Get(), and that you posted to the C++ forum, I'm assuming you're using C++. System.out.println isn't a thing in C, the equivalent is printf(). An example:
Code:
// Top of fileOne thing to note, however, is that excessive use of printf can sometimes flood the network and if this is being called every iteration, you'll get a ton of text in netconsole. I prefer to use the DriverStationLCD class, which will put the text on the right of the Operation tab of the driver station. Code:
void OperatorControl(void) |
Re: System.out.println help
Thanks, so am i correct in understanding that println is a java command not c++ which uses printf?
I will try this thanks for the help. |
Re: System.out.println help
Quote:
|
Re: System.out.println help
Actually, in most variants of C++ we've got things called "streams" that greatly enhance the readability and flexibility of code by use of the overloaded bitshift operator- for instance:
Code:
#include <iostream> |
Re: System.out.println help
it does work in windriver if you use cerr instead of cout (or if you reasign the streams)
EDIT: the C++ streams, that is |
| All times are GMT -5. The time now is 13:07. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi