Connecting to WiFi on ESP32 using credentials from SD card
you add the '\13' to the SSID and password string instead of the terminating zero, because ssid[i] = char(currbyte); runs for 13 too

use readBytesUntil()

  char ssid[33];
  int l = file.readBytesUntil('\n', ssid, sizeof(ssid));
  if (l &gt; 0 &amp;&amp; ssid[l-1] == '\r') {
    l--;
  }
  ssid[l] = 0;