User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 427,685 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,237 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 3705 | Replies: 1
Reply
Join Date: Oct 2006
Location: Jordan
Posts: 13
Reputation: khusani is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
khusani khusani is offline Offline
Newbie Poster

Storing A Long Array of bytes in an XML file.

  #1  
Nov 1st, 2006
Hey all,

I got this problem regarding storing array of bytes (Length=589824) inside an XML document.

i tried using a memory stream and it did not work.
i also tried the following lines of code:

System.Text.Encoding.UTF8.GetString(Memory Stream.ToArray());
System.Text.Encoding.UTF8.GetString(byte[]);

the result was an empty string resulting inside the XML.

NOTE: i tried the above functions on a smaller array of bytes (length = 54) and it worked.

so please anyone who has the answer i will appreciate it.

thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2003
Location: LI NY
Posts: 18
Reputation: Venjense is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 0
Venjense's Avatar
Venjense Venjense is offline Offline
Newbie Poster

Re: Storing A Long Array of bytes in an XML file.

  #2  
Nov 7th, 2006
Need more info.

I assume (hah) you are using List. This would make it so much easier for you.
List<byte> mybytes = new List<byte>();
mybytes.add(dabyte);
You can then lay down the foreach
DataTable dt = new DataTable();
dt.Columns.Add("dabyte", byte);

foreach (byte b in mybytes)
{
dt.Rows.Add(object[] {b})
}

dt.WriteXML("C:\dabytes.xml");
Venjense
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 11:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC