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?
Asked
Active
Viewed 55 times
1
-
What is the connection between this question and the Zimbra Collaboration Server software? Anyway, I think you want to look into resources/resource files or perhaps content assets. – ProgrammingLlama Oct 11 '22 at 06:05
-
You mean https://stackoverflow.com/questions/3314140/how-to-read-embedded-resource-text-file ? – Jeremy Lakeman Oct 11 '22 at 06:06
-
Have you solved the problem? – Lei Zhang-MSFT Oct 18 '22 at 01:58
1 Answers
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