Why does the following code return this error? How can I make this work?

Error: exit status 1 invalid conversion from 'const char*' to 'char' [-fpermissive]

#include "FS.h"
#include "SD.h"
#include "SPI.h"

void setup() {

  if (!SD.begin(33)) {
    Serial.println("Card Mount Failed");
  } else {
    Serial.println("Card Mount Succeeded");

  File offline = SD.open("/offlineLog.txt", FILE_READ);

  while (offline.available()) {
    String line = offline.readStringUntil("\n");

The docs say that stream.readStringUntil returns a string...

1 Answer 1


The error has nothing to do with what readStringUntil returns. It has to do with what parameters it accepts.

The function expects a single character to look for. Instead you are passing it a string (C string) containing one character.

In C you represent a string (char *) using "", and a single character (char) using ''.

Since readStringUntil expects a char, not a char *, you need to use '':

String line = offline.readStringUntil('\n');
  • Thank you! I wish that error message was more descriptive.
    – Daemach
    Apr 14, 2019 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.