Pages: 1 [2]   Go Down
Author Topic: Line Wrap in Serial Monitor  (Read 983 times)
0 Members and 1 Guest are viewing this topic.
California
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3443
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So is there a way to set a variable equal to the current number of characters?

Code:
int length = strlen(someNullTerminatedCharArray);
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So is there a way to set a variable equal to the current number of characters?

Start the variable at 1 and increment it for each character that you output. This implies that you need to print strings (and do any formatting necessary to generate those strings yourself) rather than passing numbers etc to the Serial.print routines and letting the Serial object format them for you.

Set the variable back down to zero if you print a linefeed.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: 1 [2]   Go Up
Jump to: