This code
gives me an error at saying "The given path's format is not supported." Line 24.
Would anyone know what the issue is?
C#:
using System;
using System.IO;
class Program
{
public static void Main(string[] args)
{
try
{
Console.WriteLine("Enter first number");
int.TryParse(Console.ReadLine(), out int a);
Console.WriteLine("Enter second number");
int b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(b);
int result = a / b;
Console.WriteLine(result);
}
catch(Exception ex)
{
string filePath = @"C:\SampleFiles\log.txt";
StreamWriter sw = new StreamWriter(filePath);
sw.Write(ex.GetType().Name);
sw.Write(ex.StackTrace);
sw.Close();
Console.WriteLine("There is a problem, please try later");
}
}
}
gives me an error at saying "The given path's format is not supported." Line 24.
Would anyone know what the issue is?