Flashee-eeprom issues with strings

Im trying to send an api key in from a server to my device and store it in eeprom and getting an error at the last character when storing the string into the eeprom.

This is what it looks like in the serial monitor:

here is some of the code i am using to test/debug it.
I start with

using namespace Flashee;
FlashDevice* flash;

this apiKey function is just a particle.function that allows the server to send the key in to the device. any help or suggestions would be greatly appreciated

I think your testString[32] should be larger by one character to hold the null terminator. You are using strings for the receive and store operations and using a char array for the retrieve operations. You are going to run into issues if the String is longer than anticipated. You may be storing the null terminator but not retrieving it. I would recommend changing to char arrays in the entire code and avoid String to avoid that ambiguity.


ok i tried that- ill also try converting the apiIn to a char array and see how that works, but adding one more char in the array still caused issues in the last part-

here is what i changed:

it resulted in this:

converting into char array worked. Thank you for the help. For reference if anybody is looking back on this in the future, this was the code that resolved the issue:

1 Like