TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
tom jones
NA
18
11k
CONVERTING BYTE TO DECIMAL
Feb 11 2014 2:52 PM
http://msdn.microsoft.com/en-us/library/aa326741%28v=vs.71%29.aspx[^]
//I WAS READING FROM THE ABOVE MICROSOFT LINK ABOUT CONVERTING FROM BYTE TO TO //DECIMAL IN C#, BUT I AM JUST NOT GETTING MY CODE TO WORK. I AM TRYING TO //CONVERT AN ARRAY OF BYTES TO AN ARRAY OF DECIMALS. THIS IS WHAT I AM //DOING..PLEASE KINDLY SEE BELOW.
<pre>using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
long Totbyte = 0;
string filePath = null;
DirectoryInfo da = new DirectoryInfo("C:\\Folder");
FileInfo[] Arr = da.GetFiles();
foreach (FileInfo ap in Arr)
{
Totbyte = ap.Length;
filePath = ap.FullName;
}
string temPath = Path.GetTempFileName();
byte[] data = new byte[Totbyte];
if (File.Exists(temPath))
{
data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
}
decimal decVal;
int[] arry = new int[Totbyte];
for (int count = 0; count < data.Length; count++)
{
arry[count] = decimal.GetBits((data[count])decVal);//THIS LINE DOES NOT WORK.
Console.WriteLine("Byte to Decimal = {0},,,,,, count = {1}", arry[count], count);
}
}
}
}
Reply
Answers (
1
)
Xml Issue ?In C# console or windows forms
Nested Loops problem