изменил путь

This commit is contained in:
Eugene Kazakov 2023-10-17 10:25:32 +03:00
parent 870fae65ac
commit 38083bcc01
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
using System.Text; using System.Text;
string[] files = Directory.GetFiles("../../../../var/data"); string[] files = Directory.GetFiles("/var/data");
string FilePath = ""; string FilePath = "";
long maxFileLenght = 0; long maxFileLenght = 0;
foreach(var filePath in files){ foreach(var filePath in files){
@ -14,7 +14,7 @@ using (FileStream fstream = File.OpenRead(FilePath)){
byte[] buffer = new byte[fstream.Length]; byte[] buffer = new byte[fstream.Length];
await fstream.ReadAsync(buffer, 0, buffer.Length); await fstream.ReadAsync(buffer, 0, buffer.Length);
string text = Encoding.Default.GetString(buffer); string text = Encoding.Default.GetString(buffer);
using(FileStream fstream1 = new FileStream("../../../../var/result/data.txt", FileMode.OpenOrCreate)){ using(FileStream fstream1 = new FileStream("/var/result/data.txt", FileMode.OpenOrCreate)){
fstream1.SetLength(0); fstream1.SetLength(0);
byte[] buffer1 = Encoding.Default.GetBytes(text); byte[] buffer1 = Encoding.Default.GetBytes(text);
await fstream1.WriteAsync(buffer1, 0, buffer1.Length); await fstream1.WriteAsync(buffer1, 0, buffer1.Length);

View File

@ -1,7 +1,7 @@
using System.Text; using System.Text;
string[] numbers; string[] numbers;
using (FileStream fstream = File.OpenRead("../../../../var/result/data.txt")){ using (FileStream fstream = File.OpenRead("/var/result/data.txt")){
byte[] buffer = new byte[fstream.Length]; byte[] buffer = new byte[fstream.Length];
await fstream.ReadAsync(buffer, 0, buffer.Length); await fstream.ReadAsync(buffer, 0, buffer.Length);
string text = Encoding.Default.GetString(buffer); string text = Encoding.Default.GetString(buffer);
@ -16,7 +16,7 @@ foreach(var number in numbers){
n = maxNumber*maxNumber; n = maxNumber*maxNumber;
} }
} }
using(FileStream fstream = new FileStream("../../../../var/result/result.txt", FileMode.OpenOrCreate)){ using(FileStream fstream = new FileStream("/var/result/result.txt", FileMode.OpenOrCreate)){
byte[] buffer = Encoding.Default.GetBytes(n.ToString()); byte[] buffer = Encoding.Default.GetBytes(n.ToString());
await fstream.WriteAsync(buffer, 0, buffer.Length); await fstream.WriteAsync(buffer, 0, buffer.Length);
} }