Nochmal der Code....bei der while-Anweisung hat noch etwas gefehlt....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ESAAufgabe2
{
class Program
{
public void ESA2IN(string pfad, byte[,] array)
{
FileStream stream = File.Open(pfad, FileMode.OpenOrCreate);
for (int i = 0; i < 7; i++)
{
for (int j = 0; i < 11; i++)
{
stream.WriteByte(array[i, j]);
}
}
stream.Close();
}
public void ESA2Out(string pfad)
{
StreamReader reader = new StreamReader(File.Open(pfad, FileMode.Open));
int zeichen;
while ((zeichen = reader.Read()) != -1)
{
Console.Write((char)zeichen);
}
Console.WriteLine();
reader.Close();
}
static void Main(string[] args)
{
Program test = new Program();
string pfad = @"C:\Users\admin\source\repos\CSH-Lehrgang\CSH03\VS-Projekte\Buch CSH03\ESAAufgabe2\ESA2.txt";
byte[,] array = {{ 32, 32, 67, 67, 32, 32, 32, 35, 32, 35, 32 },
{ 32, 67, 32, 32, 67, 32, 32, 35, 32, 35, 32 },
{ 67, 32, 32, 32, 32, 32, 35, 35, 35, 35, 35 },
{ 67, 32, 32, 32, 32, 32, 32, 35, 32, 35, 32 },
{ 67, 32, 32, 32, 32, 32, 35, 35, 35, 35, 35 },
{ 32, 67, 32, 32, 67, 32, 32, 35, 32, 35, 32 },
{ 32, 32, 67, 67, 32, 32, 32, 35, 32, 35, 32 } };
test.ESA2IN(pfad, array);
test.ESA2Out(pfad);
}
}
}
|