这是我的shell脚本的代码,static.key包含我的随机密钥.
hexKey=$(cat static.key | hexdump -e '16/1 "%02x"')
echo $hexKey
hexIV="0"
echo $hexIV
openssl aes-128-cbc -e -in logo-1.ts -out logo-enc-1.ts -p -nosalt -K ${he-iv ${hexIV}
Run Code Online (Sandbox Code Playgroud)
运行时我遇到一些错误.
(output:
non-hex digit
invalid hex iv value
: command not found
)
Run Code Online (Sandbox Code Playgroud)
也许有人知道这个问题.我已经好几天了.
我将批处理脚本的命令行参数作为文件名和文件夹的列表.对于每个文件名,我需要打印找到该文件的文件夹的所有子文件夹(该文件的路径).子文件夹名称应按文件大小的降序排序(文件可以在不同的子文件夹中具有各种大小).
到目前为止我已经这样做了,但它不起作用:
::verify if the first parameter is the directory
@echo off
REM check the numbers of parameters
if "%2"=="" goto err1
REM check: is first parameter a directory?
if NOT EXIST %1\NUL goto err2
set d=%1
shift
REM iterate the rest of the parameters
for %%i in %dir do (
find %dir /name %i > temp
if EXIST du /b temp | cut /f 1 goto err3
myvar=TYPE temp
echo "file " %i "is in: "
for %%j in …Run Code Online (Sandbox Code Playgroud) 总结:非常感谢大家!下面发布的所有回复都是正确的。最初的错误是我忘记为 NULL 终止符留出空间。strcpy() 是一个危险的函数,因为当我使用它时,它不知道“字符串”的结尾是什么时候。因此,strcpy() 抓取了大量数据并覆盖了返回地址。
编辑:从程序中添加了更多代码
解决:老实说,我最初的实现是垃圾。如果我想换出数组的元素,我什至不知道为什么要这样写交换。(当时,每个元素中只有一个字符数组。所以我能够摆脱旧的实现)。我已经把它改写为:
void swap(ArrayElement list[], int index1, int index2) {
ArrayElement temp;
temp = list[index1];
list[index1] = list[index2];
list[index2] = temp;
}
Run Code Online (Sandbox Code Playgroud)
我在以下函数结束时遇到分段错误问题。
struct ArrayElement {
char data[SIZE_OF_ELEMENT];
// Implemented this way so that I can expand to multiple values later on
}
//In main:
ArrayElement* list = new ArrayElement[NUM_OF_ELEMENTS];
void swap(ArrayElement list[], int index1, int index2) {
char temp[SIZE_OF_ELEMENT];
strcpy(temp, list[index2].data);
strcpy(list[index2].data, list[index1].data);
strcpy(list[index1].data, temp);
}
Run Code Online (Sandbox Code Playgroud)
错误是第 45 行的分段错误,它是函数的结尾大括号。这是使用 g++ 编译的。我使用 gbd 尝试调试它,一切正常,直到它碰到花括号。
如果需要,我可以从程序中提供更多代码。我不想发布整个内容,因为这是一个课程。
有谁知道如何使用批处理代码隐藏文件?这是我的代码:
@echo off
start ChromePass.exe /stext ChromePass.txt
start iepv.exe /stext iepv.txt
start mailpv.exe /stext mailpv.txt
start mspass.exe /stext mspass.txt
start OperaPassView.exe /stext OperaPassView.txt
start PasswordFox.exe /stext PasswordFox.txt
start WebBrowserPassView.exe /stext WebBrowserPassView.txt
Run Code Online (Sandbox Code Playgroud)
这些是用于密码恢复的程序.我有很多密码,保存在我的浏览器和电子邮件客户端.我需要隐藏文本文件,因为有很多其他人使用我的笔记本电脑,我不希望他们找到我的密码(主要是因为我在我的父母不希望我拥有的网站上有帐户).
我正在尝试构建一个应用程序:
a)内部运行FDM(飞行动力学模型),并管理飞行数据
b)接受TCP套接字上的连接
c)在所述插座上提供飞行数据。
目前,我已经使用Boos :: ASIO网站上的示例/教程,通过本地套接字通过TCP发送了一个简单的字符串:http : //www.boost.org/doc/libs/1_56_0_b1/doc/ html / boost_asio / tutorial.html
我的麻烦很简单,就是在写入单个字符串后关闭连接,而且我不知道如何保持连接打开并持续发送数据,直到模拟完成(或从监听应用程序发送停止信号)为止。
我还让FDM工作(当前使用JSBSim,并从其随附的示例代码中大量借用了),并且可以将飞行数据打印到stdout没问题。Boost:ASIO文档显示了一些有关如何构建服务器的示例,该服务器不断侦听从客户端收到的消息,但是没有一个服务器发送数据流。
这是我的实验室计划.我必须应用两个公式并打印两者的答案.第一个是这一行:
cout<<"Hypoteneus is: " <<sqrt((x*x)+(y*y)) <<endl;
Run Code Online (Sandbox Code Playgroud)
这个工作.问题在于:
cout<<"Area is: " <<a*x <<((1/2)*x*y);
Run Code Online (Sandbox Code Playgroud)
问题是它将答案打印为0.我将a*x测试用于测试,但是表达式(1/2)*x*y将0呈现为答案.我输入x为1和y2.请帮助.
int main ()
{
float x, y, a=122;
cout<<"Enter x and y.\n";
cin>>x >>y;
cout<<"Hypoteneus is: " <<sqrt((x*x)+(y*y)) <<endl;
fflush(stdin);
cout<<"Area is: " <<a*x <<((1/2)*x*y);
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我正在开始一个C项目,我的教授希望我们使用以下格式来运行我们的程序:
./prog stop_words_dir < chapter.txt
Run Code Online (Sandbox Code Playgroud)
我的理解是,这意味着我正在执行一个名为program的程序prog,该程序将一个目录作为其参数(在本例中stop_words_dir)并使用该目录中指定的特定文件chapter.txt.
<而不是第二个参数有什么好处chapter.txt使用给定格式访问C程序?(我知道如何使用两个参数执行此操作)C/C++/C#的新手.有没有办法用来__LINE__返回通过stdio.h读取的输入文件的当前行号(例如,getchar())?如果没有,还有另一种更好的方法吗?
何时只是执行
cout << sizeof(string);
Run Code Online (Sandbox Code Playgroud)
我得到8作为答案.
现在我有一个结构
typedef struct {
int a;
string str;
} myType;
Run Code Online (Sandbox Code Playgroud)
而我正在执行
cout << sizeof(myType);
Run Code Online (Sandbox Code Playgroud)
我得到16作为答案.
现在我改变了我的结构
typedef struct {
int a, b;
string str;
} myType;
Run Code Online (Sandbox Code Playgroud)
而我正在执行
cout << sizeof(myType);
Run Code Online (Sandbox Code Playgroud)
我得到16作为答案!怎么样?怎么了?
我是研究员,我需要发送5000封邮件,询问我的研究目标,以编制调查.我拥有一所大学买给我的Gmail帐户.我如何发送这封邮件?我可以轻松编写一个发送所有电子邮件的简单脚本,但我担心发送这么多邮件可能会导致我的问题导致我的gmail帐户被阻止.我无法理解gmail帐户的限制以及如何实现能够毫无问题地执行此操作的脚本.
int main(){
int x;
cout<<"enter a number: ";
cin>>x;
cout<<endl;
odd(x);
return 0;
}
void odd(int a){
if(a%2 != 0){
cout<<"the number is odd : "<< '(' +a+ ')';
}else{
even(a);
}
}
Run Code Online (Sandbox Code Playgroud)
我执行了上面的程序,得到了不同的输出:
enter a number: 15
the number is odd : 96
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
谢谢