Reading from serial port

Hello,

I have a csv file as following :

x , y, z
123,456,789
878,678,976
.
.
.

. I am trying to parse these into a Multiple-Subscripted array such as; array

[d]. However I am getting the following compiling error "expected primary-expression before 'int'." Can someone help me with this? Thank you

[november_10.ino|attachment](upload://pvPl8aAujQvC07SOm1wAvAmjf3T.ino) (467 Bytes)

Please just show your sketch in your post rather than attaching it.

Here you go:

#include
String mainstring="";
String array[int c][int d];

void setup()
{
File Test=SD.begin("TEST.csv");
Serial.begin(9600);
}

void loop()
{
while(Test.available())
{
int a=Test.read()
a=a-48;
if(((a<=9)&&(a>=0))||((a == ',') || (a == ' '))){
else if ( a ==' ' )
{
c++;
d = 0;
}else if (a == ',')
{
d++;
}else{
array

[d] += String(a);
    }
  }

   Serial.println(array[c][d]);

  }
}

int a=Test.read()

int a=Test.read();

Do yourself a favor press ctrl T to format your code.

c and d must be defined before you use them. There is also no indication of the value. I also don't think you can use Strings that way in a two dimensional array.

See Nicks section called Style Guide:

Here you go:

Next time please put the program in [code] [/code] tags.

Also, look up "isdigit()" and the other ctype functions.

@ KeithRB, I tried both your suggestions. For the first one, I did the following:
int c;int d;
String array

[ d];
and the compiler sais "array bound is not an integer constant." Also when I put in isdigit() it does not come up as a function in arduino's processing language.

This demo may be of use.

...R

"There is no indication of the value"

c and d need to be assigned values, and should ideally be made constant.

Try including ctype.h.

isdigit() it does not come up as a function in arduino's processing language.

isdigit() is a C++ function http://www.cplusplus.com/reference/cctype/isdigit/
The Arduino uses C++
so no problem