473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

How to save an array to a text file Using c# (C Sharp)

I have a 16 bit array called ADData, and i want to save this array to a text file using C#. i tried to use different codes that i located online but when i open the saved data on notepad the data appears to be corrupted.
Thank you...
Nov 8 '07 #1
3 9068
Killer42
8,435 Expert 8TB
I have a 16 bit array called ADData, and i want to save this array to a text file using C#. i tried to use different codes that i located online but when i open the saved data on notepad the data appears to be corrupted.
Thank you...
I'm not sure the VB forum is the appropriate place for this question, but where to put C# ones does seem to be a bit of an issue at present.

I'm just an old VB6 developer. But I wonder, isn't it possible that the data written to the file is OK, but simply not in a conveniently human-readable format? Have you tried reading it back into your array to see what you get?
Nov 9 '07 #2
I'm not sure the VB forum is the appropriate place for this question, but where to put C# ones does seem to be a bit of an issue at present.

I'm just an old VB6 developer. But I wonder, isn't it possible that the data written to the file is OK, but simply not in a conveniently human-readable format? Have you tried reading it back into your array to see what you get?
Thank you Killer for your help. yes i've tried to read the file after saving it, but nothing happens. i.e. the code does not seem to do anything. it neither opens the file nor reads it. here is the code i used:

StreamReader reader = new StreamReader( my-file-name );
string data = reader.ReadToEnd ();
reader.Close();

I tried to use another command for writing the data and the output was:
System.UInt16[]
which i don't know what it means. (sorry but i am not a computer science major)
Nov 10 '07 #3
Killer42
8,435 Expert 8TB
Thank you Killer for your help. yes i've tried to read the file after saving it, but nothing happens. i.e. the code does not seem to do anything. it neither opens the file nor reads it. here is the code i used:

StreamReader reader = new StreamReader( my-file-name );
string data = reader.ReadToEnd ();
reader.Close();
Sorry, this is beyond me. I only know Visual Basic, not C#.

I tried to use another command for writing the data and the output was:
System.UInt16[]
which i don't know what it means. (sorry but i am not a computer science major)
Me neither. :) I have a fair bit of experience, but on paper I'm totally unqualified.
Nov 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Simon Verona | last post by:
Not sure if this is the best group... it may be better off in one of the ADO groups, but I'm sure somebody here knows the answer: I'm trying to load up a text file using ADO.net, as follows: ...
2
by: Praveen_db2 | last post by:
Hi all Db2 8.1.3 windows Is there any way to write data into a text file using a stored procedure? The way we return a cursor output to the calling application, can we return data in a text...
2
by: asenthil | last post by:
Hai, i'm a beginner to java... just now i had tried to read and write files using java... and then i had tried to connect a database using jdbc... now i want to export the data's from a...
4
by: varsha desai | last post by:
Hello there, I want to change some data(which is in one line only) of text file using VB 6.0. Which is the best method for it? Another question is I want to delete last two, three lines...
1
by: neveen | last post by:
i want to open and read text file using j2me that can run on mobile 6630 then i want to make button called read that when pressed the data inside text display
2
by: charlesbritto | last post by:
A C++ program for counting individual string in a text file using file handling functions., for ex: if the text file contains, am a boy,am studying +2,am from chennai Now the result shoud...
2
by: sajidali | last post by:
i am trying to append a text file using c#. when i executes my application i writes to the text file using more then one functions. i want to append file only during execution of programe. next time...
0
by: Thiem Teddy | last post by:
Dear all I use VB6 to export data into xls or text file, I followed this example ( http://bytes.com/topic/visual-basic/answers/530866-how-export-table-data-into-xls-text-file-using-vb6 ). but I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.