translate this code from c ++ to c #

0

Hi, I have problems translating this code to c # I do not know very well how to use the function or do the same as I do in qt. The code is as follows:

QFile *archivo;
archivo = new QFile();
archivo->setFileName(QApplication::applicationFilePath());
archivo->open(QFile::ReadOnly);
archivo->seek(archivo->size() - 1024);
trama = archivo->read(1024);

code:

using (var reader = new StreamReader(System.Reflection.Assembly.GetExecutingAssembly().Location))
{
    if (reader.BaseStream.Length > 1024)
    {
        reader.BaseStream.Seek(-1024, SeekOrigin.End);
    }
    string line;
    while ((line = reader.ReadLine()) != null)
    {
        Console.WriteLine(line);
    }
}

Is there any possible way to do the same but in c #?

    
asked by Mohamed El Alami 26.01.2018 в 17:14
source

0 answers