Difference between " and '

I am trying to find out why my code to write to an SD card is not working. I am not sure if I am not writing to the card right or reading from the card as it seems like the program does successfully write to start with.

The code to write is shown below. One question I have concerns the line myFile.print('\r');
I have it there because when I do a read I stop when I encounter a \r. But should I use "\r" or '\r' or doesn't it make a diference?

Also, kilowattHourt is a float. Should I be using myFile.println(kilowattHourt, 2); instead?

myFile = SD.open("killog.txt", FILE_WRITE); //open file for writing
      delay(1000);
      myFile.seek(0); //set to always write to first byte of file
      myFile.println(kilowattHourt);  //kilowattHourT format  xx.yy
      myFile.print('\r');
      myFile.close(); } //save kilowattHour to file

Code to read first float from file:

 //myFile = SD.open("killog.txt");  //killog.txt holds kilowatt hour running total
     j = 0;
      do {
      // test for kwh full
      if (j == sizeof(kwh)) {
        Serial.println(F("line too long"));
        break; }
        
      kwh[j] = myFile.read(); } 
      while (kwh[j++] != '\r');	 
            
      kilowattHourt = atof(&kwh[0]);  //convert read string to float
      //Serial.print(F("KWH from SD "));
      //Serial.println(kilowattHourt); 
      myFile.close();}

Thanks guys for your help.

JC

'\r' is the character 13 decimal.
"\r" is the character array {13, 0}

Single quotes mean a single character. Double quotes mean a character array, or C string.

Single quotes mean a single character

or a multicharacter constant, like 'ab' (OK to put in an "int" or larger, but not a "char").

AWOL:

Single quotes mean a single character

or a multicharacter constant, like 'ab' (OK to put in an "int" or larger, but not a "char").

Which, from a UTF-16 perspective, would be a single character.

The word character in this context is used as a concept, not a storage size.

Thank you for the quick response. I have another question then...

doesn't myFile.println(kilowattHourt); add an \n and \r after it writes kilowattHourt? If so, do I even need to write a seperate \r? I think I would need it for sure if I was using myFile.print(kilowattHourt); , right?

JC

doesn't myFile.println(kilowattHourt); add an \n and \r after it writes kilowattHourt?

Strictly speaking, it appends a '\r' and then a '\n', but yes.