help please? how do i read variable on SD card and implement it in a program

I am lost on how to achieve obtaining a variable on the SD card and using it in a program.

This bit of code here is just me attempting to read the variable that is already on the SD card.

#include <SD.h>
#define programpin 2

const int chipSelect = 4;

File dataFile;

char filename4[] = "opsFile.csv";
char varchar;

void setup() {

pinMode(programpin, OUTPUT);
 Serial.begin(9600);                 // baud rate for computer serial communication
while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  Serial.print("Initializing SD card...");
  pinMode(chipSelect, OUTPUT);
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");

 File dataFile = SD.open(filename4);
  if(dataFile)
  {
    while (dataFile.available())
    {
    Serial.print("Data File Read: ");
    Serial.write(dataFile.read());
    Serial.println("");
    varchar = dataFile.read();
    Serial.print("Var Char: ");
    Serial.println(varchar);
    }
    dataFile.close();
}
    Serial.println(varchar);
    Serial.print("atoi varchar to var: ");
    int var = atoi(varchar);
    Serial.print(var);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Any help would be greatly appreciated.

What do you have in the file?

What happens when you run that program?

I am lost on how to achieve obtaining a variable on the SD card and using it in a program.

You can't store variables on the SD card. You can store VALUES on the SD card, and the value can be the one stored in a variable.

    Serial.write(dataFile.read());
    Serial.println("");
    varchar = dataFile.read();
    Serial.print("Var Char: ");
    Serial.println(varchar);

Read one character/byte from the file, and print it. Read and store the next character/byte read from the file, and print the stored value.

That does NOT pass the sniff test.