C # implement the file Splitter

Source: Internet
Author: User

  

The file splitter is mainly used to solve the problem of carrying large files in real life. Due to storage medium capacity limitations, large files cannot be copied to the storage media at once, this can only be done by dividing the program into multiple files that can carry small files and copying these small files step by step, so as to carry large files. The merge operator can merge the split small files and restore the original files .. Many file processing class libraries provided in the. NET Framework SDK can be used to perform file operations in a simple and flexible manner. The main content of this article is to discuss a popular application of Visual C # In File programming-file splitters and splitters. The following describes the class libraries provided by the. NET Framework SDK used by Visual C # For segmentation and merging and their usage in this article.

I. Environment for program design, debugging and operation in this article:

(1). Microsoft Windows 2000 Server Edition.

(2). Visual Studio. NET 2003 enterprise build version,. NET Framework SDK version 4322.

Ii. Visual C # class libraries used for splitting and merging programs and their usage methods:

Visual C # The class libraries used for file programming are generally in. system. in the IO namespace, system. the I/O namespace provides access methods at the data stream and file layers. The access methods generally provide synchronous and asynchronous modes. In Visual C #, classes at the data stream level are mainly used to implement split and merge programs, including filestream, binaryreader, and binarywriter, these three categories generally provide synchronous and asynchronous modes to access file data streams. This article generally adopts the synchronous mode. Although the performance is poor, it is very convenient to use, it is not prone to errors.

Filestream is a very important class for implementing file programming in Visual C #. It is embodied in the reading and writing operations on files in the file system. The filestream class provides many constructors to adapt to various specific operations. This document uses the string corresponding to the file path and the file opening method to create and initialize a filestream instance. The syntax is as follows:

Public filestream (
String path,
Filemode Mode
);

The following code uses this constructor to create and initialize a filestream instance:

Filestream splitfilestream = new filestream ("C: \ Temp. Avi", filemode. Open );

Table 01 is a common attribute of the filestream class and its description:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.