SD card problem with byte opperation

Hello friends!
I am using SD library of arduino.
I am using MEGA.
What I am using
I want to take some data from analog input and then I want to store it on card and after mapping it I want to make a waveform of it on display!
My SD card will have series of no. can be separated by “,”!

PROBLEM
When I use read command it reads entire data , I cant control read operation! I want to sort them either in memory card or in in internal ram!
But I dont understand how to do it!

My Trials
I am trying with few codes but having problem with reading dont no why!
My read write and dump example of the file works fine but when I try with following code it dont perform how i want!

#include <SPI.h>
#include <SD.h>

File myFile;
int temp1[250],j[250];
int k=1;
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.print("Initializing SD card...");

  if (!SD.begin(53)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
myFile.close();
  // nothing happens after setup
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
delay(10);
myFile = SD.open("wavel.txt", FILE_WRITE);
  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to wavel.txt...");
    Serial.println("input");
    for(int i=0;i<5;i++)
    {
      //temp1[i]=random(250);
    temp1[i]=31+i;
    
    Serial.println(temp1[i]);
    myFile.println(temp1[i]);
    }
    // close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening wavel.txt");
  }

  
delay(10);
  
  
  
  
  
  myFile = SD.open("wavel.txt");
  if (myFile) {
    
    while (myFile.available()) {
      Serial.println("wavel.txt:");
     
  for(int i=0;i<5;i++)
  {
    // read from the file until there's nothing else in it:
    
      j[i]=(myFile.read());
      Serial.write(myFile.read());
      
     
    }
    myFile.close();
  }
  Serial.print(" ");
  Serial.println("part3");
    for(int i=0;i<5;i++){
      Serial.print(" ");
     Serial.write(j[i]);
    }
  }
else {
    // if the file didn't open, print an error:
    Serial.println("error opening wavel.txt at reading");
  }
  }

void loop() {
  // nothing happens after setup
}

but the output is not what i want!
It dont give me the input no. isted it give me those 5 no. 51,10,51,10,51 I dont no how to execute it properly!

Guys I really need help on this topic! I m stuck here! Any suggestion, any link of supporrtive threads or anything could help me out so please give me suggestion on my problem!

yatin:
Guys I really need help on this topic!
I m stuck here!
Any suggestion, any link of supporrtive threads or anything could help me out so please give me suggestion on my problem!

Println() translates binary numeric values to human readable text,
File.read() returns a binary value 0…255 or -1. negative 1 is interpreted as an error.

So, if you have a variable(I) who’s value is 27 (I=27;) and you File.println(I);
This statement adds 3 bytes to the file, 50 55 10. 50 is the ASCII value for “2”, 55 is ASCII for “7”, 10 is the linefeed (LF) symbol.

So, to translate from the human readable format of the file, you have to do a little work. because you do not know how many digits each number has, you have to use the LF character as a separator.

int I=0,J;
do{
  J=File.read();
  if((J>=48)&&(J<=57)) I=(I*10)+(J-48); //build up integer value one byte at a time
  }while(J!=10);
// I now contains the binary equivalent of the human readable text.

Chuck.