我有这个..
$input = "echo a b c d"
echo -e "$input" | cut -d " " -f 2-
Run Code Online (Sandbox Code Playgroud)
但我只想要一个简单的剪切,它将摆脱回声和打印
a b c d #(single space) only
Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用C语言,我遇到了这个错误.我尝试在线查找,但其他线程包含我不熟悉的ARRAY.
#include<stdio.h>
int main(void){
char input;
printf("ASCII testing\n");
scanf( "%d", &input); //the error occurs here but would like to know the solution
printf("answer is : %c\n" , input);
system("pause");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
"运行时检查失败#2 - 变量'输入'周围的堆栈已损坏."
简单的指出将非常感激
//编辑
好吧,我想输入值"66",结果将是B. scanf("%c,&input)接受键盘上的1次击键,这不是我想要的.但是,不过,谢谢你的回复
有人能指出我的错误吗?
while(<STDIN>){
my $reverse = reverse $_; #(explicit - to force casting)
if( 5 <length ){
print "Reverse is $reverse\n";
}
else{
print; #this will print $_ scalar context
}
}
Run Code Online (Sandbox Code Playgroud)
执行程序,
1234567
Reverse is
7654321
Run Code Online (Sandbox Code Playgroud)
但如果我换
print "Reverse is $reverse\n";到print "$reverse\n"
1234567
7654321
Run Code Online (Sandbox Code Playgroud)
有人可以解释发生了什么吗?我怎么能删除换行符?
我有2个文件
$file = "songOne.wav";
$file = "song Two.wav";
Run Code Online (Sandbox Code Playgroud)
当我执行
system("command songOne.wav");
Run Code Online (Sandbox Code Playgroud)
它成功执行命令.
但是当我执行时
system("command song Two.wav");
Run Code Online (Sandbox Code Playgroud)
它给出了错误,因为它们之间有空格,因此命令将其视为2个参数,
output :
can't open file song
can't open file Two.wav
Run Code Online (Sandbox Code Playgroud)
如何使命令将它们视为一个文件?
谢谢