The problem is I can't figure How to write console output to file. I want to save the results in a txt file I have been trying to look this up and I couldn't figure out how it works. I'm really stupid and I need some help I'd appreciate any help thanks in advance
using System;
using System.Drawing;
using System.Security.Cryptography;
using System.Text;
namespace ConsoleApp1
{
internal class Program
{
public static string GetUniqueUSG(int maxSize)
{
char[] array = new char[62];
array = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
byte[] array2 = new byte[1];
RNGCryptoServiceProvider rngcryptoServiceProvider = new RNGCryptoServiceProvider();
rngcryptoServiceProvider.GetNonZeroBytes(array2);
array2 = new byte[maxSize];
rngcryptoServiceProvider.GetNonZeroBytes(array2);
StringBuilder stringBuilder = new StringBuilder(maxSize);
foreach (byte b in array2)
{
stringBuilder.Append(array[(int)b % array.Length]);
}
return stringBuilder.ToString();
}
public static string GetUniqueUSG2(int maxSize)
{
char[] array = new char[62];
array = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".ToCharArray();
byte[] array2 = new byte[1];
RNGCryptoServiceProvider rngcryptoServiceProvider = new RNGCryptoServiceProvider();
rngcryptoServiceProvider.GetNonZeroBytes(array2);
array2 = new byte[maxSize];
rngcryptoServiceProvider.GetNonZeroBytes(array2);
StringBuilder stringBuilder = new StringBuilder(maxSize);
foreach (byte b in array2)
{
stringBuilder.Append(array[(int)b % array.Length]);
}
return stringBuilder.ToString();
}
private static void Main(string[] args)
{
for (int i = 0; i < 21247483647; i++)
{
Console.Write(string.Concat(new string[]
{
"N",
Program.GetUniqueUSG(24),
".X",
Program.GetUniqueUSG2(5),
".",
Program.GetUniqueUSG2(27),
"\n"
}), Color.Blue, Color.Fuchsia, 14);
Console.Title = "By Theo Bagwell";
}
Console.ReadKey();
}
}
}