i ll need 1 million samples atleast..and i would need same 50,000 samples in one second continuously
There is no point in logging a time series of one million samples in a program like yours. The information content of a time series depends as much on the time a point is logged as the value. There are mathematical treatments of the information content of such a time series but I won't go to that level. Just think of plotting a two dimensional curve in the x-y plane. It won't be correct unless you know both x and y for each point.
SD cards have random write delays of up to 250 milliseconds so you may have huge time uncertainty in your data.
Here is a program that triggers the ADC with a timer to eliminate time jitter, reads the ADC in an interrupt routine to avoid data loss, buffers the data for a background process that writes it to an SD Try this super fast analog pin logger - Storage - Arduino Forum.
The above logger is for an AVR Arduino. You need something like this for Due.
I tried writing O_APPEND to continue writing values ..but same result..
remove the O_TRUNC, it truncates the file to be empty.
if(!file.open("pleasework.txt", O_WRITE|O_CREAT|O_TRUNC))
is there any command to directly write the values stored in the array to the card without using the loop i.e writing all value at a time instead of writing them one by one..
Write the entire array in binary and convert the file to text later. Make your buffer a multiple of 512 bytes, the size of an SD block. The optimum size is 32KB, the cluster size on a properly formatted SDHC card.
int SdFile::write (const void* buf, size_t nbyte )
Write data to an open file.
Note
Data is moved to the cache but may not be written to the storage device until sync() is called.
Parameters
[in] buf Pointer to the location of the data to be written.
[in] nbyte Number of bytes to write.
Don't use an array of int since your data is under 16-bits, use a 16-bit short array. This will save memory and reduce the size of the binary file.