problem with and serial.parseint...

hi everyone,
I'm new in this forum... I have a problem with read a buffer by serialPort.
I receive a bytes buffer by serial and I need to convert some byte in char and others in int...
When I write Serial.parseInt() I can't convert only one bytes, he convert it all.

For example:


the third byte must I convert in int, because it tell me the length of the next string(char).

Someone can help me?

Is the data that you receive terminated in any way, perhaps with a carriage return and/or linefeed ?
Does the string always start at the same place in the received data ?
How long is the string in the example you gave ? Can you please provide a second example with a different length string.
Do you have control over the format of the data being sent ?

Please post your program as it is now but read this first and follow the advice on formatting the code and using code tags

if the length is the third character you could use

void setup() {
  // put your setup code here, to run once:
  char data[]="FF7F050A6D6167696B";
  int length=data[2]-'0';

prints 7
however, what if the length is 17? is it always less than 10?

FF7F050A6D6167696B looks suspiciously like ASCII to me

FF 7F 05 0A 6D 61 67 69 6B
            m  a  g  i  k

FF7F050A6D6167696B looks suspiciously like ASCII to me

FF 7F 05 0A 6D 61 67 69 6B

m  a  g  i  k

yes,it's rigth, it's only a model


Are you receiving a series of chars
'F' 'F' '7' 'F' etc

or a series of bytes
255 127 5 10 109 97 etc

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.