using System;
using System.IO;
class CopyFile
{
public static void Main(string[] args)
{
int i;
FileStream fin;
FileStream fout;
try
{
// open input file
try
{
fin = new FileStream("abc.txt", FileMode.Open);
}
catch (FileNotFoundException exc)
{
Console.WriteLine(exc.Message + "\nInput File Not Found");
return;
}
// open output file
try
{
fout = new FileStream("xyz.txt", FileMode.Create);
}
catch (IOException exc)
{
Console.WriteLine(exc.Message + "\nError Opening Output
File");
return;
}
}
catch (IndexOutOfRangeException exc)
{
Console.WriteLine(exc);
return;
}
//copy the file
try {
do {
i = fin.ReadByte();
if (i != -1) { fout.WriteByte((byte)i); }
}
while (i != -1);
}
catch (IOException exc)
{
Console.WriteLine(exc);
return;
}
fin.Close();
fout.Close();
}
}
What is the use of return here in this progg
While writing the prog by mistake I had forgot to write return in this block
catch (IndexOutOfRangeException exc)
{
Console.WriteLine(exc);
return;
}
After that my progg start giving me error that fin and fout are not
initialized
what return do in this kind of code