How to copy contents from an sd card [Arduino Mega]

I've interfaced a SD card reader with Arduino Mega 2560. I figured out the connection and sample programs throught examples.

What I'm trying to do is, I've connected a TTP229 touch keypad and servo motor, and I'm working on a simple door lock.

PROBLEM: I've stored the password in my SD card and not in the arduino program itself. So when I try to read contents from SD card I can only see the contents on Serial Terminal Window using Serial.print command..

I want to copy the contents of sd card into a variable lets say "x" and I can't figure out the program to do so.

Can someone help me with that?

You where given an example that shows you how to write data to an SD card then turn around and read the data back.

File::Examples::SD::ReadWrite (I don’t know where it is on a MAC, I’m assuming is the same thing)

I meant I want to copy a number which I’ve stored in the SD card, into an arduino integer variable “X”

The “Serial.write” function will write the provided data into SD card. How is it supposed to copy data into a variable? :stuck_out_tongue:

How is it supposed to copy data into a variable?

how about x =