indexof problem: request for member indexof in ..

Hello,

I would like to use the indexOf function with Arduino 0019 program:

part of code:

int bytesread=0;
int maxbytes=5000;
String filecontents[maxbytes];

bytesread=file.read(filecontents, maxbytes);
if (bytesread >= maxbytes) PgmPrint("Error to much data in config file ");

file.close(); //Close the file

Serial.println("bytesread");Serial.print(bytesread);
// Serial.print(filecontents);

char line[80];
int sensorCounter;int weekdayCounter;int programCounter;
int oldposChar=0;

int newposChar=(filecontents.indexOf(';',0));

So I read a file (via sd shield) in the string filecontents.
I always get the following error on the indexOf function:
request for member 'indexOf' in 'filecontents', which is a non-class type 'String [(((unsigned int)(((int)maxbytes) + -0x000000001)) + 1)]'

Can anyone tell me what I'm doing wrong ?

Thanks in advance,
Jeroen.

String filecontents[maxbytes];

The square brackets define an array of String instances. You wanted parentheses to define a single instance of a maximum size.

The fileContents array, then, does not have an indexOf operator.

hello,

I am not understanding it completely.

What does I need to change (datatype) for filecontents to get this working ? (because I need the indexof function)

Thanks.

int i[5]; declares an array of integers that can hold 5 values. By using [maxbytes] after filecontents, you declared an array of Strings that don't contain any data.

You wanted, I'm pretty sure, (maxbytes) which is how to pass a value to the constructor of the String class.