我试图将我用汇编语言编写的引导加载程序转换为ISO映像文件.以下是MikeOS bootloader 的代码.这是我的引导程序代码:
BITS 16
start:
mov ax, 07C0h ; Set up 4K stack space after this bootloader
add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
mov ss, ax
mov sp, 4096
mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax
mov si, text_string ; Put string position into SI
call print_string ; Call our string-printing routine
jmp $ ; Jump here - infinite loop!
text_string db 'This …Run Code Online (Sandbox Code Playgroud) 我使用 Gnome Archive Manager (Ubuntu OS) 创建了一个 zip 文件。我使用密码创建了 zip 文件,并尝试使用zipfilePython 库解压缩它:
import zipfile
file_name = '/home/mahmoud/Desktop/tester.zip'
pswd = 'pass'
with zipfile.ZipFile(file_name, 'r') as zf:
zf.printdir()
zf.extractall(path='/home/mahmoud/Desktop/testfolder', pwd = bytes(pswd, 'utf-8'))
Run Code Online (Sandbox Code Playgroud)
当我运行此代码时,出现以下错误,并且我非常确定密码正确。错误是:
File "/home/mahmoud/anaconda3/lib/python3.7/zipfile.py", line 1538, in open
raise RuntimeError("Bad password for file %r" % name)
RuntimeError: Bad password for file <ZipInfo filename='NegSkew.pdf' compress_type=99 filemode='-rw-rw-r--' external_attr=0x8020 file_size=233252 compress_size=199427>
Run Code Online (Sandbox Code Playgroud)
如何解压缩文件?
我正在写一个简单的程序.该程序有2个QStrings设置有以下变量:文件的路径和名称,有一个第三个QString,我稍后用它来将前2个QString的追加结果放在一起.我想做的是附加2 QStrings并将它们放在appendAll QString中,然后将appendAll QString发送到QFile变量构造函数.现在,当我这样做时,它打印"无法创建文件",这是我使用的代码:
#include <QString>
#include <QTextStream>
#include <QFile>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTextStream output(stdout);
QString location = "/home/mahmoud/Destkop";
QString name = "mahmoud.txt";
QString appendAll;
if( !location.endsWith("/") )
{
location.append("/");
}
appendAll = location.append(name);
output << appendAll << endl;
QFile myFile(appendAll);
if(myFile.open(QIODevice::WriteOnly | QIODevice::Text ))
{
output << "File Has Been Created" << endl;
}
else
{
output << "Failed to Create File" << endl;
}
QTextStream writeToFile(&myFile);
writeToFile << "Hello World" << endl; …Run Code Online (Sandbox Code Playgroud)