无效的运行时参数_itoa_s [英] invalid cruntime parameter _itoa_s
问题描述
我使用 _itoa_s
和 _ultoa_s
时遇到了一个奇怪的行为,如果我尝试从一个 DWORD
。该函数返回零(成功),我的应用程序继续,但我得到一个错误代码 0xc0000417(STATUS_INVALID_CRUNTIME_PARAMETER)
的异常窗口。
ULONG pid = ProcessHandleToId(hProcess);
int size = getIntSize(pid);
char * pidStr = new char [size + 1];
_ultoa_s(pid,pidStr,size + 1,10);
// do sth with pidStr ...
delete [](pidStr);`
$ b b
ProcessHandleToId
为给定的 ProcessHandle $返回
PID(DWORD)
c $ c>。
getIntSize
将数字的数目返回到相应的 int /
是的,安全的CRT函数将会中止你的脚本。
程序,当它们检测到问题时,状态代码为0xc0000417。这意味着您正在查找这个问题的源代码错误。它不是_ultoa_s()调用,这是轰炸你的程序。这是另一个函数调用,在代码中的其他地方。我不能帮你找到它当然。但调试器应该给你一个好主意,看看调用堆栈当它打破。
I have experienced a strange behavior when using _itoa_s
and _ultoa_s
if I try to get a char array from an DWORD
. The function returns zero(success) and my application continues, but I'm getting an exception window with error code 0xc0000417 (STATUS_INVALID_CRUNTIME_PARAMETER)
.
ULONG pid = ProcessHandleToId(hProcess);
int size = getIntSize(pid);
char *pidStr = new char[size+1];
_ultoa_s(pid, pidStr, size+1, 10);
//do sth with pidStr...
delete[] (pidStr);`
ProcessHandleToId
returns the PID (DWORD)
for a given ProcessHandle
.
getIntSize
returns the number of numbers to the corresponding int/char
array (5555 => 4).
Yes, the safe CRT functions will abort your program with status code 0xc0000417 when they detect a problem. However, they will do this immediately, the function will not return.
Which means that you are looking at the wrong source code for this problem. It isn't the _ultoa_s() call that's bombing your program. It's another function call, somewhere else in your code. I can't help you find it of course. But the debugger should give you a good idea, look at the call stack when it breaks.
这篇关于无效的运行时参数_itoa_s的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!