Create a C# program that makes copies of both text and binary files. You can use FileStream to assign a buffer size of 512 Kb.
public class FileCopier
public static void Main(string args)
const int BUFFER_SIZE = 512 * 1024;
byte data = new byte[BUFFER_SIZE];
string inputFileName = "app.exe";
string outputFileName = "app-copy.exe";
using (FileStream inputFile = File.OpenRead(inputFileName))
using (FileStream outputFile = File.Create(outputFileName))
amountRead = inputFile.Read(data, 0, BUFFER_SIZE);
outputFile.Write(data, 0, amountRead);
while (amountRead == BUFFER_SIZE);
Practice C# anywhere with the free app for Android devices.
Learn C# at your own pace, the exercises are ordered by difficulty.
Own and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.