Missing terminating ' character

Good day everyone! Hope you’re all safe and sound. I’m trying to save some strings to the EEPROM for a project. The code below is not mine, I found it on Arduino Write a String in EEPROM - The Robotics Back-End. It is supposed to be able to save three strings on the EEPROM. However when I compile it, it tells me that in line 69 I´m missing an " " as a terminating character. If I´m not mistaken that character is closing the other " " in line 25. However I´ve checked the code like 20 times by now, and just can´t find why the compiler tells me I´m still missing one. Any help or advice is appreciated. Stay safe!!

EEPROM.ino (2.72 KB)

void loop() {}</pre>';Please explain exactly what this code (line 69) is supposed to do

Was it perhaps copied from a Web page ?

Try

void loop() {};

Two setups and two loops?

UKHeliBob:
void loop() {}</pre>';Please explain exactly what this code (line 69) is supposed to do

Was it perhaps copied from a Web page ?

Try

void loop() {};

Correct, I added the website’s URL on my original post to avoid plagiarism. To be honest I’m not completely sure. I’m rereading the code and I think it’s actually two codes embedded in one.

when I compile the code i get the following error

C:\stuff\SW\Arduino\_Others\Download\Tst\Tst.ino:25:21: warning: missing terminating ' character

for the following line

 data[newStrLen] = '<pre class="EnlighterJSRAW" data-enlighter-language="cpp">#include <EEPROM.h>

there are several problems.

data is an array of chars. the code attempts to set an element of that array to a string which is a gross error. the array might be set to a string but not an single element of the array

but the code 1) uses a single quote instead of double quotes to delimit the string, 2) doesn’t escape double quotes within the string (e.g ="Enlight) and 3 doesn’t have a closing double quote

'<pre class="EnlighterJSRAW" data-enlighter-language="cpp">#include <EEPROM.h>

however, the line following the one above, “int writeStringToEEPROM”, appear to be a function definition which suggest that a closing brace “}” is missing.

int readStringFromEEPROM(int addrOffset, String *strToRead)
{
  int newStrLen = EEPROM.read(addrOffset);
  char data[newStrLen + 1];

  for (int i = 0; i < newStrLen; i++)
  {
    data[i] = EEPROM.read(addrOffset + 1 + i);
  }
  data[newStrLen] = '<pre class="EnlighterJSRAW" data-enlighter-language="cpp">#include <EEPROM.h>

int writeStringToEEPROM(int addrOffset, const String &strToWrite)
{

there are other problems with the code, but it appears to have some gross syntax errors