String not coveting to int.

I'm writing a program to get the list of values of a SD card file into usable values but the string value will not convert to a int variable. The SD card file is taken from a app I built. The string that is taken from the SD card file is laid out as the following example.

List of values from app: {000.00, 123.45, 098.70, 656.00}

SD card file is laid out as: 000.00123.45098.70656.00

I'm able to put the string into char and get the individual values in the list to its own string, but when I go to set that string it does not work. Example follows:

String: 000.00

Serial Print String to int:

<
+

The part of the code where I'm attempting to the string to int is under void draw().

#include <Wire.h>
#include "rgb_lcd.h"
#include <SPI.h>
#include <SD.h>
#include <Stepper.h>

const int stepsPerRevolution = 1000;
String Yval = "";
int view = 0;
char FileChar[] = {"oof"};
char FileChar2[] = {"oof"};
int i = 0;
String Xval = "";
const int chipSelect = 4;
rgb_lcd lcd;
const int colorR = 0;
const int colorG = 0;
const int colorB = 0;
int TouchSec = 0;
int Version = 1.0;
char* Main[]= {"Print", "Information", "Options"};
int delayTime = 100;
String Select = "SELECT";
char Ymap[] = {"fun"};
char Xmap[] = {"fun"};
int X1 = 10;
int Y1 = 20;
int X2 = 10;
int Y2 = 20;
int TransX = 0;
int TransY = 0;
int Line = 0;
int slope = 0;
int Rise = 0;
int Run = 0;
int Rest = 0;
int Draw = 180;
int numX = 0;
int placeX = 0;
String CurentX = "";
int numY = 0;
int placeY = 0;
String CurentY = "";

Stepper myStepper(stepsPerRevolution, 14,15,16,17);
int val = 0;
void setup() {
	
	 myStepper.setSpeed(150);
	int view = 1;
  // put your setup code here, to run once:
  lcd.begin(16, 2);
  lcd.setRGB(colorR, colorG, colorB);
  clearScreen(); 
  lcd.setRGB(200 , 255, 200);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(8) == 1){
  	TouchSec++;
  	Print();
  	delay(500);
  }else{
  	TouchSec = 0;
 }
 if (view == 1)
  clearScreen();
   
   
}

void clearScreen() {
	Select = String(Main[TouchSec]);
  lcd.setCursor(0, 0);
  lcd.print("CNC PLOTTER V1.0");
  
  if (TouchSec == 0){
  	lcd.setCursor(0, 1);
 lcd.print("    <" + Select + ">    ");
  }
  if (TouchSec == 1){
  	lcd.setCursor(0, 1);
 lcd.print(" <" + Select + ">  ");
  }
  if (TouchSec == 2){
  	lcd.setCursor(0, 1);
 lcd.print("   <" + Select + ">   ");
  }
  
}
void Print() {
 myStepper.step(-60);

lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Initializing ");
lcd.setCursor(0, 1);
  lcd.print("SD Card...");
  delay(1000);
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
  	lcd.clear();
  lcd.setCursor(0, 0);
   lcd.setRGB(255 , 5, 5);
    lcd.print("Card failed");
     lcd.setCursor(0, 1);
   lcd.setRGB(255 , 5, 5);
    lcd.print("or is not present");
    // don't do anything more:
    while(1);
    delay(1000);
  }
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Card Initialized.");
   myStepper.step(120);
delay(1000);
   // re-open the file for reading:
File  myFile = SD.open("X.TXT");
  if (myFile) {
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
    	char FileChar = myFile.read();
    	Xval = Xval + String(FileChar);
     } 
     
     Serial.println("XmapCheck:   " + String(Xmap));
      myFile.close();
     File myFile = SD.open("Yval.TXT");

  // if the file is available, write to it:
  if (myFile) {
    while (myFile.available()) {
      	char FileChar2 = myFile.read();
    	Yval = Yval + String(FileChar2); 
    
    }
   	myFile.close();
     lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Complete");
   lcd.setRGB(5 , 255, 5);
  Yval.toCharArray(Ymap, (Yval.length() + 1));
    lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("done");
  wouldYouPrint();
   
   
    }
  // if the file isn't open, pop up an error:
  else {
  	 lcd.clear();
  	  lcd.setRGB(255 , 5, 5);
  lcd.setCursor(0, 0);
  lcd.print("Error Opening");
  lcd.setCursor(0, 1);
  lcd.print("File(s)");
  }
  }
  
  
}


	


void Info() {
	
}
void Settings() {
	
}
void wouldYouPrint() {
Line = 0;
numX = 0;

 Serial.println("Ymap:   " + String(Ymap));
  draw();
}
void draw(){
Xval.toCharArray(Xmap, (Xval.length() + 1));
    //get X1
    numX = Line;
    placeX = numX * 6;
 	CurentX = "";
 	CurentX = String(CurentX + String(Xmap[placeX]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 1)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 2)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 3)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 4)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 5)]));
 	X1 = (CurentX.toInt());
	Serial.println("X1: " + X1);
	Yval.toCharArray(Ymap, (Yval.length() + 1));
	//get Y1
	numY = Line;
	placeY = numY * 6;
 	CurentY = "";
 	CurentY = String(CurentY + String(Ymap[placeY]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 1)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 2)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 3)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 4)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 5)]));
 	Y1 = (CurentY.toInt());
 Serial.println("Y1: " + Y1);
 Xval.toCharArray(Xmap, (Xval.length() + 1));
 	//get X2
 	numX = (Line + 1);
    placeX = numX * 6;
 	CurentX = "";
 	CurentX = String(CurentX + String(Xmap[placeX]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 1)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 2)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 3)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 4)]));
 	CurentX = String(CurentX + String(Xmap[(placeX + 5)]));
 	X2 = (CurentX.toInt());
Serial.println("X2: " + X2);
Yval.toCharArray(Ymap, (Yval.length() + 1));
	//get Y2
	numY = (Line + 1);
	placeY = numY * 6;
 	CurentY = "";
 	CurentY = String(CurentY + String(Ymap[placeY]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 1)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 2)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 3)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 4)]));
 	CurentY = String(CurentY + String(Ymap[(placeY + 5)]));
 	X2 = (CurentY.toInt());
 Serial.println("Y2: " + Y2);
	//get slope
	slope = ((Y2 - Y1) / (X2 - X1));
	Serial.println(slope);
	TransX = X1;
	TransX = X1;
  
  lcd.setCursor(0, 0);
  lcd.print(String("Start: [X:" + X1));
  lcd.setCursor(0, 1);
  lcd.print(String("End: [X:" + X1));
	
}
void Translate(){
	if (!(X1 == X2)){
	if (X1 > X2){
		TransX++;
	}else{
		TransX--;
	}
	TransY = TransY + slope;
	Translate();
	}else{
	 Line++;
	 draw();
	}
	
}

I tried to read you code. I nearly vomited. Use Tools + Auto Format BEFORE posting code that looks like that crap.

You clearly need to (re-)read the documentation for toCharArray(). The second argument is NOT the length of the String instance. The instance already KNOWS how long it is. It does not need your ham-fisted help.

Your extreme abuse of the String class is sickening.

The String class' + operator KNOWS how to concatenate a char or a string or a String to an EXISTING String. It is NOT necessary to create and destroy two MORE String instances to add ONE char to a String.

Printing the contents of the String before calling toInt() just might whack you with a clue-by-four.

  1. Integers don't have decimals, so the decimal will be truncated using string.toInt(). string.toFloat() would preserve the floating point value, but the Arduino UNO really doesn't have a floating point math unit, so consider moving the math up a few significant digits so your values are all integers.
  2. no one likes the String class as it can corrupt your memory. Consider replacing it's use with c-style strings.
  3. if you use c-style strings, you can use atoi() or atol() among other useful standard library functions.

With these type of problems it’s worth writing a short bit of code addressing the problem area - it’s easier to get working and debug it before you add to your program.

Try that , then post up the problem, if you still have it .