Receiving garbled `char` array returned by a functionHow to loop over objects or pass object to function?Shift register 1's and 0's array to 4 int's function not workingI2C_Anything String / Char Array issuesHow can I pass a char array as the parameter to a function?HID-Project problems with keycode enumsTransfer a struct's data to an external struct via serial?Dynamicly sized array as a class memberPassing a substring to a function or subSet array to array passed as parameter in constructorPassing user defined callback functions to a library method
How long would it take to cross the Channel in 1890's?
Why don't countries like Japan just print more money?
UK - Working without a contract. I resign and guy wants to sue me
I found a password with hashcat, but it doesn't work
What's currently blocking the construction of the wall between Mexico and the US?
Did the CIA blow up a Siberian pipeline in 1982?
Is there a term for the belief that "if it's legal, it's moral"?
DBCC checkdb on tempdb
How can lift be less than thrust that is less than weight?
Does Doppler effect happen instantly?
Heavily limited premature compiler translates text into excecutable python code
Trainee keeps passing deadlines for independent learning
Shooting someone's past self using special relativity
Do I need a shock-proof watch for cycling?
Explain why a line can never intersect a plane in exactly two points.
How do I handle a table mixing up the DM and the players' roles too often?
I don't like coffee, neither beer. How to politely work my way around that in a business situation?
Understanding the reasoning of the woman who agreed with Shlomo to "cut the baby in half"
When two first person POV characters meet
Why tighten down in a criss-cross pattern?
Can a rogue use Sneak Attack in a Darkness spell cast by another player?
If the Dragon's Breath spell is cast on a familiar, does it use the wizard's DC or familiar's DC?
What happened to Steve's Shield in Iron Man 2?
Calibrations vs. Riemannian holonomy
Receiving garbled `char` array returned by a function
How to loop over objects or pass object to function?Shift register 1's and 0's array to 4 int's function not workingI2C_Anything String / Char Array issuesHow can I pass a char array as the parameter to a function?HID-Project problems with keycode enumsTransfer a struct's data to an external struct via serial?Dynamicly sized array as a class memberPassing a substring to a function or subSet array to array passed as parameter in constructorPassing user defined callback functions to a library method
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I return a char[300]
array from a function. If I intialize a char*
variable with it, the return is garbled, but not if I append it to a String
. What gives?
const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
String postS2 = "";
postS2 = uploadHourCsv(timeNow,pulseChangeHour) ;
//const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
if( debug )
Serial.print("received in loop() as : [");
Serial.println(post2);
Serial.print("String : [");
Serial.println(postS2);
...
char postStr[300] = "";
// populate array
if( debug )
Serial.print("postStrCsv generated: ");
Serial.println(postStr);
return postStr;
postStrCsv generated: 00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
received in loop() as : [000?⸮@⸮⸮?" ⸮⸮?17.55;9|17.58! @0⸮⸮⸮⸮G% @5~`⸮h⸮?⸮⸮
String : [00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
c++
add a comment |
I return a char[300]
array from a function. If I intialize a char*
variable with it, the return is garbled, but not if I append it to a String
. What gives?
const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
String postS2 = "";
postS2 = uploadHourCsv(timeNow,pulseChangeHour) ;
//const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
if( debug )
Serial.print("received in loop() as : [");
Serial.println(post2);
Serial.print("String : [");
Serial.println(postS2);
...
char postStr[300] = "";
// populate array
if( debug )
Serial.print("postStrCsv generated: ");
Serial.println(postStr);
return postStr;
postStrCsv generated: 00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
received in loop() as : [000?⸮@⸮⸮?" ⸮⸮?17.55;9|17.58! @0⸮⸮⸮⸮G% @5~`⸮h⸮?⸮⸮
String : [00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
c++
What exactly does theuploadHourCsv
return? Since post2 is declared as a pointer, without any size, the function has to return a pointer to an already allocated string to do this.
– chrisl
Jun 4 at 11:16
char postStr[300]
with contents displayed in blockquote.
– tony gil
Jun 4 at 14:53
1
How is this Arduino specific? Despite two excellent (and upvoted) answers below, I say that such questions 1) belong on stackoverflow.com and 2) will get better answers more quickly tehre (no offence to those here)
– Mawg
Jun 5 at 6:19
tks. do you think that we should move this to SO? flag for moderator attention or flag to close saying "belongs in so"
– tony gil
Jun 7 at 16:55
add a comment |
I return a char[300]
array from a function. If I intialize a char*
variable with it, the return is garbled, but not if I append it to a String
. What gives?
const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
String postS2 = "";
postS2 = uploadHourCsv(timeNow,pulseChangeHour) ;
//const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
if( debug )
Serial.print("received in loop() as : [");
Serial.println(post2);
Serial.print("String : [");
Serial.println(postS2);
...
char postStr[300] = "";
// populate array
if( debug )
Serial.print("postStrCsv generated: ");
Serial.println(postStr);
return postStr;
postStrCsv generated: 00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
received in loop() as : [000?⸮@⸮⸮?" ⸮⸮?17.55;9|17.58! @0⸮⸮⸮⸮G% @5~`⸮h⸮?⸮⸮
String : [00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
c++
I return a char[300]
array from a function. If I intialize a char*
variable with it, the return is garbled, but not if I append it to a String
. What gives?
const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
String postS2 = "";
postS2 = uploadHourCsv(timeNow,pulseChangeHour) ;
//const char* post2 = uploadHourCsv(timeNow,pulseChangeHour) ;
if( debug )
Serial.print("received in loop() as : [");
Serial.println(post2);
Serial.print("String : [");
Serial.println(postS2);
...
char postStr[300] = "";
// populate array
if( debug )
Serial.print("postStrCsv generated: ");
Serial.println(postStr);
return postStr;
postStrCsv generated: 00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
received in loop() as : [000?⸮@⸮⸮?" ⸮⸮?17.55;9|17.58! @0⸮⸮⸮⸮G% @5~`⸮h⸮?⸮⸮
String : [00000003;3| 0.00;8|17.55;9|17.55;10|18.12;11|16.92;20|93817;22|93789;101|6;time|1559646000;
c++
c++
edited Jun 5 at 7:59
Edgar Bonet
26k22546
26k22546
asked Jun 4 at 11:11
tony giltony gil
208215
208215
What exactly does theuploadHourCsv
return? Since post2 is declared as a pointer, without any size, the function has to return a pointer to an already allocated string to do this.
– chrisl
Jun 4 at 11:16
char postStr[300]
with contents displayed in blockquote.
– tony gil
Jun 4 at 14:53
1
How is this Arduino specific? Despite two excellent (and upvoted) answers below, I say that such questions 1) belong on stackoverflow.com and 2) will get better answers more quickly tehre (no offence to those here)
– Mawg
Jun 5 at 6:19
tks. do you think that we should move this to SO? flag for moderator attention or flag to close saying "belongs in so"
– tony gil
Jun 7 at 16:55
add a comment |
What exactly does theuploadHourCsv
return? Since post2 is declared as a pointer, without any size, the function has to return a pointer to an already allocated string to do this.
– chrisl
Jun 4 at 11:16
char postStr[300]
with contents displayed in blockquote.
– tony gil
Jun 4 at 14:53
1
How is this Arduino specific? Despite two excellent (and upvoted) answers below, I say that such questions 1) belong on stackoverflow.com and 2) will get better answers more quickly tehre (no offence to those here)
– Mawg
Jun 5 at 6:19
tks. do you think that we should move this to SO? flag for moderator attention or flag to close saying "belongs in so"
– tony gil
Jun 7 at 16:55
What exactly does the
uploadHourCsv
return? Since post2 is declared as a pointer, without any size, the function has to return a pointer to an already allocated string to do this.– chrisl
Jun 4 at 11:16
What exactly does the
uploadHourCsv
return? Since post2 is declared as a pointer, without any size, the function has to return a pointer to an already allocated string to do this.– chrisl
Jun 4 at 11:16
char postStr[300]
with contents displayed in blockquote.– tony gil
Jun 4 at 14:53
char postStr[300]
with contents displayed in blockquote.– tony gil
Jun 4 at 14:53
1
1
How is this Arduino specific? Despite two excellent (and upvoted) answers below, I say that such questions 1) belong on stackoverflow.com and 2) will get better answers more quickly tehre (no offence to those here)
– Mawg
Jun 5 at 6:19
How is this Arduino specific? Despite two excellent (and upvoted) answers below, I say that such questions 1) belong on stackoverflow.com and 2) will get better answers more quickly tehre (no offence to those here)
– Mawg
Jun 5 at 6:19
tks. do you think that we should move this to SO? flag for moderator attention or flag to close saying "belongs in so"
– tony gil
Jun 7 at 16:55
tks. do you think that we should move this to SO? flag for moderator attention or flag to close saying "belongs in so"
– tony gil
Jun 7 at 16:55
add a comment |
2 Answers
2
active
oldest
votes
It's because you're returning a pointer to a local variable.
You are only returning the address in memory where your char array is allocated. That allocation is on the stack and only exists for the lifetime of the function. But you still have the address where that memory was allocated, and you're using it as if it's still allocated.
When you append it to a String room is allocated on the heap and the data is copied in. That heap allocation remains until the String object is destroyed, either by going out of scope or by you manually destroying it.
It's pure chance that the data is still available and intact at the point of copying.
In short:
- You must never return a pointer to a locally allocated (non-static) array.
Things you can do that are correct:
- Pass an array pointer to the function to be populated by the function
- Return a pointer to a statically allocated local array
- Return a
String
object (though I wouldn't recommend using String for anything)
My preferred method is the first, whereby you define an array in the outer scope, then pass that (and possibly the array length) to the function. The function then populates the array it has been passed. This also has the advantage that the function can use the return value to indicate a status or other quantity.
For example:
void myFunc(char *buf, int len)
for (int i = 0; i < len - 1; i++)
buf[i] = 'A';
buf[len - 1] = 0;
char myBuf[20];
myFunc(myBuf, 20);
Serial.println(myBuf);
--> AAAAAAAAAAAAAAAAAAAA
1
U da man! UPVOTED and ACCEPTED. Re use ofString
: totally agree, unsafe memory allocation in String class.
– tony gil
Jun 4 at 14:50
add a comment |
Following Majenko's invaluable advice and incorporating another similar approach, final working implementation was to treat the function as a method to operate upon the char[300]
array as "out parameter".
char postStr[300] = "";
uploadHourCsv(timeNow,pulseChangeHour,postStr) ;
...
void uploadHourCsv(int unixtimeEvent, int pulseChange, char* postStr)
// prepare data and variables
strcat(postStr, stationId);
strcat(postStr,";3
2
If you make the firststrcat
astrcpy
instead, you can avoid initializing the array first. (And note that the way you initialize it in the caller fills the entire length with zero bytes, not just the first element, so that takes a lot longer than necessary unless it gets optimized away.)
– Peter Cordes
Jun 5 at 10:29
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("schematics", function ()
StackExchange.schematics.init();
);
, "cicuitlab");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "540"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2farduino.stackexchange.com%2fquestions%2f65995%2freceiving-garbled-char-array-returned-by-a-function%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
It's because you're returning a pointer to a local variable.
You are only returning the address in memory where your char array is allocated. That allocation is on the stack and only exists for the lifetime of the function. But you still have the address where that memory was allocated, and you're using it as if it's still allocated.
When you append it to a String room is allocated on the heap and the data is copied in. That heap allocation remains until the String object is destroyed, either by going out of scope or by you manually destroying it.
It's pure chance that the data is still available and intact at the point of copying.
In short:
- You must never return a pointer to a locally allocated (non-static) array.
Things you can do that are correct:
- Pass an array pointer to the function to be populated by the function
- Return a pointer to a statically allocated local array
- Return a
String
object (though I wouldn't recommend using String for anything)
My preferred method is the first, whereby you define an array in the outer scope, then pass that (and possibly the array length) to the function. The function then populates the array it has been passed. This also has the advantage that the function can use the return value to indicate a status or other quantity.
For example:
void myFunc(char *buf, int len)
for (int i = 0; i < len - 1; i++)
buf[i] = 'A';
buf[len - 1] = 0;
char myBuf[20];
myFunc(myBuf, 20);
Serial.println(myBuf);
--> AAAAAAAAAAAAAAAAAAAA
1
U da man! UPVOTED and ACCEPTED. Re use ofString
: totally agree, unsafe memory allocation in String class.
– tony gil
Jun 4 at 14:50
add a comment |
It's because you're returning a pointer to a local variable.
You are only returning the address in memory where your char array is allocated. That allocation is on the stack and only exists for the lifetime of the function. But you still have the address where that memory was allocated, and you're using it as if it's still allocated.
When you append it to a String room is allocated on the heap and the data is copied in. That heap allocation remains until the String object is destroyed, either by going out of scope or by you manually destroying it.
It's pure chance that the data is still available and intact at the point of copying.
In short:
- You must never return a pointer to a locally allocated (non-static) array.
Things you can do that are correct:
- Pass an array pointer to the function to be populated by the function
- Return a pointer to a statically allocated local array
- Return a
String
object (though I wouldn't recommend using String for anything)
My preferred method is the first, whereby you define an array in the outer scope, then pass that (and possibly the array length) to the function. The function then populates the array it has been passed. This also has the advantage that the function can use the return value to indicate a status or other quantity.
For example:
void myFunc(char *buf, int len)
for (int i = 0; i < len - 1; i++)
buf[i] = 'A';
buf[len - 1] = 0;
char myBuf[20];
myFunc(myBuf, 20);
Serial.println(myBuf);
--> AAAAAAAAAAAAAAAAAAAA
1
U da man! UPVOTED and ACCEPTED. Re use ofString
: totally agree, unsafe memory allocation in String class.
– tony gil
Jun 4 at 14:50
add a comment |
It's because you're returning a pointer to a local variable.
You are only returning the address in memory where your char array is allocated. That allocation is on the stack and only exists for the lifetime of the function. But you still have the address where that memory was allocated, and you're using it as if it's still allocated.
When you append it to a String room is allocated on the heap and the data is copied in. That heap allocation remains until the String object is destroyed, either by going out of scope or by you manually destroying it.
It's pure chance that the data is still available and intact at the point of copying.
In short:
- You must never return a pointer to a locally allocated (non-static) array.
Things you can do that are correct:
- Pass an array pointer to the function to be populated by the function
- Return a pointer to a statically allocated local array
- Return a
String
object (though I wouldn't recommend using String for anything)
My preferred method is the first, whereby you define an array in the outer scope, then pass that (and possibly the array length) to the function. The function then populates the array it has been passed. This also has the advantage that the function can use the return value to indicate a status or other quantity.
For example:
void myFunc(char *buf, int len)
for (int i = 0; i < len - 1; i++)
buf[i] = 'A';
buf[len - 1] = 0;
char myBuf[20];
myFunc(myBuf, 20);
Serial.println(myBuf);
--> AAAAAAAAAAAAAAAAAAAA
It's because you're returning a pointer to a local variable.
You are only returning the address in memory where your char array is allocated. That allocation is on the stack and only exists for the lifetime of the function. But you still have the address where that memory was allocated, and you're using it as if it's still allocated.
When you append it to a String room is allocated on the heap and the data is copied in. That heap allocation remains until the String object is destroyed, either by going out of scope or by you manually destroying it.
It's pure chance that the data is still available and intact at the point of copying.
In short:
- You must never return a pointer to a locally allocated (non-static) array.
Things you can do that are correct:
- Pass an array pointer to the function to be populated by the function
- Return a pointer to a statically allocated local array
- Return a
String
object (though I wouldn't recommend using String for anything)
My preferred method is the first, whereby you define an array in the outer scope, then pass that (and possibly the array length) to the function. The function then populates the array it has been passed. This also has the advantage that the function can use the return value to indicate a status or other quantity.
For example:
void myFunc(char *buf, int len)
for (int i = 0; i < len - 1; i++)
buf[i] = 'A';
buf[len - 1] = 0;
char myBuf[20];
myFunc(myBuf, 20);
Serial.println(myBuf);
--> AAAAAAAAAAAAAAAAAAAA
answered Jun 4 at 11:21
Majenko♦Majenko
70.6k43683
70.6k43683
1
U da man! UPVOTED and ACCEPTED. Re use ofString
: totally agree, unsafe memory allocation in String class.
– tony gil
Jun 4 at 14:50
add a comment |
1
U da man! UPVOTED and ACCEPTED. Re use ofString
: totally agree, unsafe memory allocation in String class.
– tony gil
Jun 4 at 14:50
1
1
U da man! UPVOTED and ACCEPTED. Re use of
String
: totally agree, unsafe memory allocation in String class.– tony gil
Jun 4 at 14:50
U da man! UPVOTED and ACCEPTED. Re use of
String
: totally agree, unsafe memory allocation in String class.– tony gil
Jun 4 at 14:50
add a comment |
Following Majenko's invaluable advice and incorporating another similar approach, final working implementation was to treat the function as a method to operate upon the char[300]
array as "out parameter".
char postStr[300] = "";
uploadHourCsv(timeNow,pulseChangeHour,postStr) ;
...
void uploadHourCsv(int unixtimeEvent, int pulseChange, char* postStr)
// prepare data and variables
strcat(postStr, stationId);
strcat(postStr,";3
2
If you make the firststrcat
astrcpy
instead, you can avoid initializing the array first. (And note that the way you initialize it in the caller fills the entire length with zero bytes, not just the first element, so that takes a lot longer than necessary unless it gets optimized away.)
– Peter Cordes
Jun 5 at 10:29
add a comment |
Following Majenko's invaluable advice and incorporating another similar approach, final working implementation was to treat the function as a method to operate upon the char[300]
array as "out parameter".
char postStr[300] = "";
uploadHourCsv(timeNow,pulseChangeHour,postStr) ;
...
void uploadHourCsv(int unixtimeEvent, int pulseChange, char* postStr)
// prepare data and variables
strcat(postStr, stationId);
strcat(postStr,";3
2
If you make the firststrcat
astrcpy
instead, you can avoid initializing the array first. (And note that the way you initialize it in the caller fills the entire length with zero bytes, not just the first element, so that takes a lot longer than necessary unless it gets optimized away.)
– Peter Cordes
Jun 5 at 10:29
add a comment |
Following Majenko's invaluable advice and incorporating another similar approach, final working implementation was to treat the function as a method to operate upon the char[300]
array as "out parameter".
char postStr[300] = "";
uploadHourCsv(timeNow,pulseChangeHour,postStr) ;
...
void uploadHourCsv(int unixtimeEvent, int pulseChange, char* postStr)
// prepare data and variables
strcat(postStr, stationId);
strcat(postStr,";3
Following Majenko's invaluable advice and incorporating another similar approach, final working implementation was to treat the function as a method to operate upon the char[300]
array as "out parameter".
char postStr[300] = "";
uploadHourCsv(timeNow,pulseChangeHour,postStr) ;
...
void uploadHourCsv(int unixtimeEvent, int pulseChange, char* postStr)
// prepare data and variables
strcat(postStr, stationId);
strcat(postStr,";3
answered Jun 4 at 15:35
tony giltony gil
208215
208215
2
If you make the firststrcat
astrcpy
instead, you can avoid initializing the array first. (And note that the way you initialize it in the caller fills the entire length with zero bytes, not just the first element, so that takes a lot longer than necessary unless it gets optimized away.)
– Peter Cordes
Jun 5 at 10:29
add a comment |
2
If you make the firststrcat
astrcpy
instead, you can avoid initializing the array first. (And note that the way you initialize it in the caller fills the entire length with zero bytes, not just the first element, so that takes a lot longer than necessary unless it gets optimized away.)
– Peter Cordes
Jun 5 at 10:29
2
2
If you make the first
strcat
a strcpy
instead, you can avoid initializing the array first. (And note that the way you initialize it in the caller fills the entire length with zero bytes, not just the first element, so that takes a lot longer than necessary unless it gets optimized away.)– Peter Cordes
Jun 5 at 10:29
If you make the first
strcat
a strcpy
instead, you can avoid initializing the array first. (And note that the way you initialize it in the caller fills the entire length with zero bytes, not just the first element, so that takes a lot longer than necessary unless it gets optimized away.)– Peter Cordes
Jun 5 at 10:29
add a comment |
Thanks for contributing an answer to Arduino Stack Exchange!
- 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%2farduino.stackexchange.com%2fquestions%2f65995%2freceiving-garbled-char-array-returned-by-a-function%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
What exactly does the
uploadHourCsv
return? Since post2 is declared as a pointer, without any size, the function has to return a pointer to an already allocated string to do this.– chrisl
Jun 4 at 11:16
char postStr[300]
with contents displayed in blockquote.– tony gil
Jun 4 at 14:53
1
How is this Arduino specific? Despite two excellent (and upvoted) answers below, I say that such questions 1) belong on stackoverflow.com and 2) will get better answers more quickly tehre (no offence to those here)
– Mawg
Jun 5 at 6:19
tks. do you think that we should move this to SO? flag for moderator attention or flag to close saying "belongs in so"
– tony gil
Jun 7 at 16:55