哇,从没想过我会在DOS上写任何东西.现在我做了,我知道为什么我从来没想过.语法很荒谬!
无论如何我需要帮助.我想提示用户输入,如果收到空白行,我想使用默认值,如下所示:
set name=abraham.
set /p input=please enter your name, press enter to use %name%:
if not %input%=="" set name=%input%
echo your name is %name%
Run Code Online (Sandbox Code Playgroud)
我收到一个错误,说"此时设置是意料之外的."
你能帮帮忙吗?
嗨,我正在尝试创建一个系统调用,将计算被调用的分叉数.我打算更改fork系统调用,以便它有一个计数器来跟踪fork()被调用的次数.我计划在fork.h中添加一个静态变量,然后每次调用fork.c时都增加它.我根本不明白fork.c中发生了什么.这甚至是正确的方法吗?
我曾经用TASM编译我的asm代码(在winXP上),但是我遇到了一些麻烦所以现在我使用NASM(在linux上).这段代码展示了我正在尝试做的事情:
(gdb) list 35
30 xor ecx,ecx # ecx is a counter
31 mov bl, ' ' # this is what I'm looking for
32 count_spaces:
33 mov al,[esi] # grab a char
34 jz spaces_counted # is this the end?
35 inc esi # next char
36 cmp al,bl # found one?
37 jne count_spaces # nope, loop
38 inc ecx # yep, inc counter
39 jmp count_spaces # and loop
Run Code Online (Sandbox Code Playgroud)
这对我来说是正确的,但是:
Breakpoint 1, main () at …Run Code Online (Sandbox Code Playgroud) asm_execve.s:
.section .data
file_to_run:
.ascii "/bin/sh"
.section .text
.globl main
main:
pushl %ebp
movl %esp, %ebp
subl $0x8, %esp # array of two pointers. array[0] = file_to_run array[1] = 0
movl file_to_run, %edi
movl %edi, -0x4(%ebp)
movl $0, -0x8(%ebp)
movl $11, %eax # sys_execve
movl file_to_run, %ebx # file to execute
leal -4(%ebp), %ecx # command line parameters
movl $0, %edx # environment block
int $0x80
leave
ret
生成文件:
NAME = asm_execve
$(NAME) : $(NAME).s
gcc -o $(NAME) $(NAME).s
程序已执行,但未调用sys_execve: …
我想知道是否有办法在C中找到称为当前函数(在运行时)的函数.
我知道你可以__FUNCTION__在gcc中使用,但有没有办法不使用C预处理器?
可能不是.
干杯
当我在Solaris SPARC上编译Lua(5.1.4)时,我收到以下警告......还有很多......
以下只是一个片段:
# /usr/ccs/bin/make solaris
cd src && /usr/ccs/bin/make solaris
/usr/ccs/bin/make all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl"
/usr/sfw/bin/gcc -O2 -Wall -DLUA_USE_POSIX -DLUA_USE_DLOPEN -c lapi.c
lapi.c: In function `luaA_pushobject':
lapi.c:92: warning: visibility attribute not supported in this configuration; ignored
/usr/sfw/bin/gcc -O2 -Wall -DLUA_USE_POSIX -DLUA_USE_DLOPEN -c lcode.c
lcode.c: In function `luaK_getlabel':
lcode.c:97: warning: visibility attribute not supported in this configuration; ignored
lcode.c: In function `luaK_concat':
lcode.c:196: warning: visibility attribute not supported in this configuration; ignored
lcode.c: In function `luaK_patchtohere':
lcode.c:182: warning: visibility attribute …Run Code Online (Sandbox Code Playgroud) 在运行期间,如何获取寄存器fs中的值并在"call*fs:0x334"中计算目标函数的地址?我可以使用什么样的x86组件?