1

I'm a blind person and I'm trying to create a win form app that aims to help people with visual impairments to learn better the keyboard. There are different levels in this program. such as: match characters, match words and match sentences. Almost I finished everything, but I miss the technique of storing txt files in the source code in order to be invisible to the user in the program files. Any suggestion?

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86

1 Answers1

0

You can use the StreamWriter method.

https://learn.microsoft.com/en-us/dotnet/api/system.io.streamwriter?view=net-7.0

A complete example:

internal class Program
{
    static void Main(string[] args)
    {
        // Get the directories currently on the C drive.
        DirectoryInfo[] cDirs = new DirectoryInfo(@"c:\").GetDirectories();

        // Write each directory name to a file.
        using (StreamWriter sw = new StreamWriter("Demo.txt"))
        {
            foreach (DirectoryInfo dir in cDirs)
            {
                sw.WriteLine(dir.Name);
            }
        }

        // Read and show each line from the file.
        string line = "";
        using (StreamReader sr = new StreamReader("Demo.txt"))
        {
            while ((line = sr.ReadLine()) != null)
            {
                Console.WriteLine(line);
            }
        }
    }
}
Lei Zhang-MSFT
  • 280
  • 1
  • 5