- Netduino Forums
- → somaia's Content
The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
somaia's Content
There have been 4 items by somaia (Search limited from 29-April 23)
#37103 read file from SD
Posted by somaia on 12 October 2012 - 11:36 PM in Netduino 2 (and Netduino 1)
Hi
I tried 2G-SD card but it gives me the same error " An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.IO.dll". What can i do?
#37051 read file from SD
Posted by somaia on 11 October 2012 - 07:31 PM in Netduino 2 (and Netduino 1)
Hi Chris
I’m sorry, but I’m beginner in netduino. Do you mean, I have to replace the 4G-SD card I have with 2G-SD card.
Or could you please explain the solution of the problem in more details.
Thanks
#37025 read file from SD
Posted by somaia on 11 October 2012 - 09:28 AM in Netduino 2 (and Netduino 1)
Ya. but |I tried This code
while (r.Peek() >= 0)
{
enc_plain.WriteLine(r.ReadLine());
}
but I give me the same error "System.IndexOutOfRangeException' occurred in System.IO.dll"
#36983 read file from SD
Posted by somaia on 10 October 2012 - 07:34 PM in Netduino 2 (and Netduino 1)
Hello
I have netduino board.I interfaced 4G SD card with it.I had saved file in the SD card then I tried to read it line by line.Each line I read I write it in a new file.The program is working normally but after reading some lines this error appear "An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.IO.dll".
This is my program can anyone help me please.
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.IO;
using SecretLabs.NETMF.IO;
using System.Text;
namespace NetduinoApplication1
{
public class Program
{
public static void Main()
{
// write your code here
StorageDevice.MountSD("SD", SPI_Devices.SPI1, Pins.GPIO_PIN_D10);
string line; // line that will read from the pliantext
FileStream aa = new FileStream("SD\\enc_f.txt", FileMode.Create, FileAccess.Write, FileShare.None);
StreamWriter enc_plain = new StreamWriter(aa);
FileStream sr = new FileStream("SD\\text.txt", FileMode.Open);//, FileAccess.Read,FileShare.None);
StreamReader r = new StreamReader(sr);
int c = 0;
while ((line = r.ReadLine()) != null)
{
line = r.ReadLine();
enc_plain.WriteLine(line);
c++;
}
aa.Close();
enc_plain.Close();
sr.Close();
r.Close();
- Netduino Forums
- → somaia's Content
- Privacy Policy