Click here to Skip to main content
15,904,153 members
Home / Discussions / C#
   

C#

 
GeneralRe: Mouse Events in windows application C# Pin
musefan29-Apr-09 23:27
musefan29-Apr-09 23:27 
AnswerRe: Mouse Events in windows application C# Pin
Spunky Coder29-Apr-09 23:08
Spunky Coder29-Apr-09 23:08 
AnswerRe: Mouse Events in windows application C# Pin
Mycroft Holmes30-Apr-09 0:24
professionalMycroft Holmes30-Apr-09 0:24 
QuestionHow to select a specific cell? Pin
Saiyed Alam29-Apr-09 22:39
Saiyed Alam29-Apr-09 22:39 
AnswerRe: How to select a specific cell? Pin
Mycroft Holmes29-Apr-09 22:45
professionalMycroft Holmes29-Apr-09 22:45 
AnswerRe: How to select a specific cell? Pin
NickPace30-Apr-09 4:28
NickPace30-Apr-09 4:28 
QuestionSplit text file by Fixed Length Pin
yueru29-Apr-09 21:48
yueru29-Apr-09 21:48 
AnswerRe: Split text file by Fixed Length Pin
musefan29-Apr-09 21:54
musefan29-Apr-09 21:54 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 22:04
yueru29-Apr-09 22:04 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 22:10
musefan29-Apr-09 22:10 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 22:40
yueru29-Apr-09 22:40 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 22:46
musefan29-Apr-09 22:46 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:16
yueru29-Apr-09 23:16 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 23:28
musefan29-Apr-09 23:28 
GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:41
yueru29-Apr-09 23:41 
GeneralRe: Split text file by Fixed Length Pin
musefan29-Apr-09 23:56
musefan29-Apr-09 23:56 
GeneralRe: Split text file by Fixed Length [modified] Pin
yueru30-Apr-09 0:09
yueru30-Apr-09 0:09 
GeneralRe: Split text file by Fixed Length Pin
musefan30-Apr-09 0:36
musefan30-Apr-09 0:36 
GeneralRe: Split text file by Fixed Length Pin
OriginalGriff30-Apr-09 1:33
mveOriginalGriff30-Apr-09 1:33 
AnswerRe: Split text file by Fixed Length Pin
N a v a n e e t h29-Apr-09 21:58
N a v a n e e t h29-Apr-09 21:58 
QuestionRe: Split text file by Fixed Length Pin
yueru29-Apr-09 22:06
yueru29-Apr-09 22:06 
AnswerRe: Split text file by Fixed Length Pin
yueru5-May-09 21:23
yueru5-May-09 21:23 
AnswerRe: Split text file by Fixed Length Pin
Mycroft Holmes29-Apr-09 21:59
professionalMycroft Holmes29-Apr-09 21:59 
AnswerRe: Split text file by Fixed Length Pin
Vasudevan Deepak Kumar29-Apr-09 22:33
Vasudevan Deepak Kumar29-Apr-09 22:33 
Quoting Sean Hederman from
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/b0d4cba1-471a-4260-94c1-fddd4244fa23/[^]

string sourceFileName = @"C:\VS2005 SP1.exe";

string destFileLocation = @"C:\";

int index = 0;

long maxFileSize = 52428800;

byte[] buffer = new byte[65536];

 

using (Stream source = File.OpenRead(sourceFileName))

{

    while (source.Position < source.Length)

    {

        index++;

 

        // Create a new sub File, and read into t

        string newFileName = Path.Combine(destFileLocation, Path.GetFileNameWithoutExtension(sourceFileName));

        newFileName += index.ToString() + Path.GetExtension(sourceFileName);

        using (Stream destination = File.OpenWrite(newFileName))

        {

            while (destination.Position < maxFileSize)

            {

                // Work out how many bytes to read

                int bytes = source.Read(buffer, 0, (int) Math.Min(maxFileSize, buffer.Length));

                destination.Write(buffer, 0, bytes);

 

                // Are we at the end of the file?

                if (bytes < Math.Min(maxFileSize, buffer.Length))

                {

                    break;

                }

            }

        }

    }

}


Vasudevan Deepak Kumar
Personal Homepage
Tech Gossips


The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!




GeneralRe: Split text file by Fixed Length Pin
yueru29-Apr-09 23:24
yueru29-Apr-09 23:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.