Hello and Happy new year to all members of this community
I'm still trying to learn how to manipulate string using array and buffer. The end goal is to construct an URL that will send data to trough PushingBox to a Google Sheet
I came across a tutorial: C - Strings See the code below
My childish and un-experience question.
How do I get the result be printed using the Serial.print function on the COM3 page.
Serial.printf is not accepted by the compiler
Any help, tutorial link, library or explanation about using array of char[] to create a URL string? I'm stuck with this since too long and I want to learn how to properly use string in the Arduino Uno memory limitations.
My "C++" is very embryonic. I do understand the difference between a string and a char[array] of character to create a string. I need to learn the proper function on library that will let me manipulate strings using the array of characters concept
Martin
Montreal, Canada
P.S. Excuse my English, more fluent in French.
#include <stdio.h>
#include <string.h>
int main () {
char str1[12] = "Hello";
char str2[12] = "World";
char str3[12];
int len ;
/* copy str1 into str3 */
strcpy(str3, str1);
printf("strcpy( str3, str1) : %s\n", str3 );
/* concatenates str1 and str2 */
strcat( str1, str2);
printf("strcat( str1, str2): %s\n", str1 );
/* total lenghth of str1 after concatenation */
len = strlen(str1);
printf("strlen(str1) : %d\n", len );
return 0;
}
As to your program, did you deliberately not use the normal Arduino setup() and loop() functions ?
A minor point but one that will cause confusion if you don't do it correctly, C style strings (zero terminated arrays of chars) are usually referred to as strings (lowercase s) whilst String objects created using the String library are usually referred to as Strings (uppercase S).
UKHeliBob:
As to your program, did you deliberately not use the normal Arduino setup() and loop() functions ?
A minor point but one that will cause confusion if you don't do it correctly, C style strings (zero terminated arrays of chars) are usually referred to as strings (lowercase s) whilst String objects created using the String library are usually referred to as Strings (uppercase S).
I just copy the code from the tutorial page. So nothing is deliberate...
I did try to modify the code by including the loop and setup() before asking,
Thanks for the differentiation between "strings" and "String". While I'm still not able to properly work with [stings] I do understand that they are not the same as String.
Can you please supply a link to the page that you copied the code from ?
Actually I had no problem following you explanation in your first place despite the fact that you mixed the use of string and String but is not always the case