ESP8266: How to exchange string to int or long?

Sorry if this is easy question.

Just I want to exchange string to int on Arduino IDE.
I used atoi() and toInt(). Both function need each way, but successed compile.
sample from verious way I tryed.

String abc ;

File f =, “r”); // read the length
abc = f.readStringUntil(‘\n’);

long rawBufLength =abc.toInt(); <----- here is issue

toInt returns long on ESP (of course I tryed int).
Without transrate to rawBuflength, no matter.
But this and these kind of code couse exception every time !

hepl me !

((( here is exception )))

Exception (9):
epc1=0x4020718e epc2=0x00000000 epc3=0x00000000 excvaddr=0xfeeff002 depc=0x00000000

ctx: cont
sp: 3fff1950 end: 3fff1ba0 offset: 01a0

3fff1af0: 3fffdad0 3fff1b60 3fff1be8 4020716f
3fff1b00: 3ffe9040 00000000 000003e8 00000512
3fff1b10: 00000000 00000000 00000000 00000000
3fff1b20: 00000000 3fff1e68 0000000f 00000004
3fff1b30: feeff002 3fff1c1c 3fff1c18 4020aee7
3fff1b40: 40201772 00000000 3fff1be8 3fff0b74
3fff1b50: 3fffdad0 3fff1be8 3fff1be8 4020747f
3fff1b60: feefeffe feefeffe feefeffe feefeffe
3fff1b70: feefeffe feefeffe feefeffe feefeffe
3fff1b80: feefeffe 00000000 3fff0b6c 40209c54
3fff1b90: feefeffe feefeffe 3fff0b80 40100114

Do you get some error when you do

int rawBufLength =abc.toInt();


Thank you for repl.
error ? on down area of skech ? —> no, complie is complete and no err when the exception happan.

I tryed easy sketch , no matter with this…mm…
I shoul check all the sketck.

include < FS.h >
const char* irdata = “/IRdata.txt”; //IR data file
int aaa = 293;
String abc;

void setup() {

File f;
f =, “w”); // save the length


f =, “r”); // read the length
abc = f.readStringUntil(’\n’);

long rawBufLength = abc.toInt(); /// <<<======here is OK

void loop() {