C
C#3y ago
?

Write to file not working (StreamWriter)

using System;
using System.Numerics;
using System.Text;
using System.IO;
namespace Username
{
class Program
{
static void Main()
{
bool end = false;
string filePath = @"C:\Users\Administrator\Desktop\HEXes.txt";

StreamWriter hap = new(filePath, false, Encoding.Unicode);

hap.WriteLine($"{F:N0} is {F:X}"); // there are variables I didn't mention, I just wanted to show here I write to file

hap.Close();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("\nPress any key to continue...");
Console.ReadKey();
}
}
}
using System;
using System.Numerics;
using System.Text;
using System.IO;
namespace Username
{
class Program
{
static void Main()
{
bool end = false;
string filePath = @"C:\Users\Administrator\Desktop\HEXes.txt";

StreamWriter hap = new(filePath, false, Encoding.Unicode);

hap.WriteLine($"{F:N0} is {F:X}"); // there are variables I didn't mention, I just wanted to show here I write to file

hap.Close();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("\nPress any key to continue...");
Console.ReadKey();
}
}
}
It creates HEXes.txt but the file is empty Never mind, my silly mistake. Closing.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server