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
11.1k
ReadAllBytes Method of the File Class PROBLEM
Feb 10 2014 10:44 AM
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;//file length initialize to 0
DirectoryInfo da = new DirectoryInfo("C:\\Folder");//local file on the computer
FileInfo[] Arr = da.GetFiles();
foreach (FileInfo ap in Arr)
Totbyte = ap.Length;//real file length on local computer
Console.WriteLine("Total Bytes = {0} bytes", Totbyte);//the code works great up to this point
//want to set up an array for the exact file length above and read all bytes into the array
//not sure of what I am doing below, but its not working out
string temPath = Path.GetTempFileName();
string temPath2 = Path.GetTempFileName();
if (File.Exists(temPath))
{
byte[Totbyte] data = File.ReadAllBytes(temPath);
File.WriteAllBytes(temPath2, data);
}
}
}
}
Reply
Answers (
7
)
events
C# 2012 app connec to ssrs report