Haxo
Haxo
CC#
Created by Haxo on 4/25/2024 in #help
How to Read byte by byte until EOF?
Hello! I couldn't find an answer on the internet on this question so I guess I will have to ask it. I am trying to make my own version of WinRar and to avoid using too much RAM I want to read and write the file byte by byte. How do I do it? Here's the code:
using System;
using System.IO;

namespace Paxer;

class Core
{
public static void writeFile(FileStream _target, string root, string sub_path)
{
// What is origin?
string full_path = Path.Combine(root, sub_path);

FileInfo file_info = new FileInfo(full_path);
FileStream _from = new FileStream(full_path, FileMode.Open);

// Lenghts
long path_len = sub_path.Length;
byte[] path_blen = BitConverter.GetBytes(path_len);

long len = file_info.Length;
byte[] blen = BitConverter.GetBytes(len);

// Write
byte b;

// What to do here ???
}
}
using System;
using System.IO;

namespace Paxer;

class Core
{
public static void writeFile(FileStream _target, string root, string sub_path)
{
// What is origin?
string full_path = Path.Combine(root, sub_path);

FileInfo file_info = new FileInfo(full_path);
FileStream _from = new FileStream(full_path, FileMode.Open);

// Lenghts
long path_len = sub_path.Length;
byte[] path_blen = BitConverter.GetBytes(path_len);

long len = file_info.Length;
byte[] blen = BitConverter.GetBytes(len);

// Write
byte b;

// What to do here ???
}
}
19 replies
CC#
Created by Haxo on 12/11/2023 in #help
Publish fails with --self-contained/--sc switch
No description
37 replies