Convert Char to Int

Im reading a text in the SD card. Here is the code:

void Readline(){
  myFile.seek(0);
  char cr;
  for(unsigned int i = 0; i < 0;){
    cr = myFile.read();
    if(cr == '\n')
      {
        i++;
      }
  }
  while(true){
    cr = myFile.read();
    if((cr == '\n')||(cr == '\r')||(cr < 0))
    break;
    Serial.println(cr);
  }
}

How can I convert the char 'cr' to integer?

void Readline(){
  myFile.seek(0);
  char cr;
  for(unsigned int i = 0; i < 0;){
    cr = myFile.read();
    if(cr == '\n')
      {
        i++;
      }
  }
  while(true){
    cr = myFile.read();
    if((cr == '\n')||(cr == '\r')||(cr < 0))
    break;
    //Serial.print(cr);
    String a = String(cr);
    Serial.print(a);
 }
}

I cant seem to convert the string to float. What am I doing wrong?

What's that supposed to do

for([color=red]unsigned[/color] int i = [color=red]0[/color]; i [color=red]< 0[/color]; ){...}

How is that building a float?

    String a = String(cr)

You might want to read about parseFloat()

How can I convert the char 'cr' to integer?

What should the integer value be when cr is 'D'?

If cr is >= '0' and <= '9', simply subtract '0' from cr to get the integer value.

im sorry i still find it hard to understand this code.
what if the value inside the SD card is "6.25". How can I read and get that value and store it in a float variable? van you give me a sample code of that?

what if the value inside the SD card is "6.25".

Then the title of the thread is wrong.

What separates the float values ?

Read each character of the float and put it into a char array. When the entire float has been read (see question above), terminate the char array with a zero and use the atof() function to convert the array to a float.

sir can you give me a sample code of that?

I have this code right here:

  myFile = SD.open("Kup.txt");
  if (myFile) {
    Serial.println("Kup.txt:");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      String a = String(myFile.read());
      Serial.print(a);
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }

first what i am trying to do is read first the value and store it in a string variable then afterwards convert it into a float. This part Im having problems reading the value. The value written inside the SD card is 6.75. When I store it into a string. I dont seem to get the right values. What im getting is this:

544653551310

@bembe24, do not cross-post. Threads merged.

Read answer #2