我知道这些启动Xdebug的方法:
?XDEBUG_SESSION_START=name 在网址中
xdebug.remote_autostart=On 在php.ini中
-dxdebug.remote_autostart=On 作为PHP二进制调用的参数
但我不知道如何在代码中启动xdebug,是否有任何函数xdebug_start()和xdebug_stop()?
以下是如何使用常规变量执行此操作的示例:
SET _test=123456789abcdef0
SET _result=%_test:~-7%
ECHO %_result%
:: that shows: abcdef0
Run Code Online (Sandbox Code Playgroud)
但是如果在开始时使用双百分比的变量(如%%A),那么for循环中需要这样的变量:
FOR /D %%d IN (c:\windows\*) DO (
echo %%d
)
Run Code Online (Sandbox Code Playgroud)
这有效,但是:
FOR /D %%d IN (c:\windows\*) DO (
echo %%d:~-7%
)
Run Code Online (Sandbox Code Playgroud)
只需复制:~-7到echo命令即可
通过'删除',我的意思是重置可能在此类元素上下降的所有样式并将其置于浏览器默认值.
我需要这个用于调试,我不知道什么规则造成了伤害,我的好方法是删除所有样式然后逐个松开限制以检查事情何时开始出错.
你有没有在网上看到任何包含以下内容的片段:
{ right: auto !important; left: auto !important; visibility: visible !important;...
Run Code Online (Sandbox Code Playgroud)
通过各种可能的风格等等.
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
int main(void) {
_setmode(_fileno(stdout), _O_U16TEXT);
wprintf(L"\x043a\x043e\x0448\x043a\x0430 \x65e5\x672c\x56fd\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在编译时返回错误: _O_U16TEXT was not declared in this scope
这是此编译器的制胜法宝吗?
可能重复:
提取当前可执行文件名称
我创建了一个从ini文件读取配置的程序,该文件的名称应该与可执行文件的名称相同,但当然还有其扩展名.因此,如果我将其命名myprogram.exe为config myprogram.ini,那么如果我在编译后更改exe的名称,它应该看起来符合它的新名称.
我知道可以从中获取程序名称,argv[0]但只有当它从命令行开始时才有效,当它在资源管理器中单击时,此数组为空.
当我在这里阅读答案时,我认为它必须对此功能做一些事情:https://stackoverflow.com/a/10572632/393087 - 但我找不到任何使用该功能的好例子,我是非常初学c ++和一般函数定义(就像在微软页面上提到的那样)对我来说太难理解,但是当我得到一个有效的例子时,我很容易理解.
这是测试示例:
(1).简单程序做无限循环:
#include <iostream>
using namespace std;
int main() {
int counter = 0;
while (1) cout << ++counter << ": endless loop..." <<endl;
}
Run Code Online (Sandbox Code Playgroud)
(2).通过system()命令启动以上示例的另一个程序:
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
system("endless_loop.exe");
cout << "back to main program" << endl;
}
Run Code Online (Sandbox Code Playgroud)
在执行Ctrl+Break此程序时,文本back to main program不显示.如何将此组合键限制为内部进程并将执行指针返回主应用程序?
另一件事是我并不总是能控制内部程序的源代码,所以我无法改变那里的东西.
在这里,我有一系列重载函数,它们以向量或初始化列表作为输入。我想处理客户端代码输入空的初始化列表时的特殊情况。问题是编译器无法确定在这样的空列表中应该有哪些数据。所以我的问题是我如何在函数声明中解决这种情况。
#include <string>
#include <vector>
using namespace std;
void func(vector<string> v) { }
void func(vector<wstring> v) { }
void func(initializer_list<string> iv) {}
void func(initializer_list<wstring> iv) {}
int main() {
using namespace std;
func({"apple", "banana"});
func({L"??", L"??"});
func({}); // special case
}
Run Code Online (Sandbox Code Playgroud)
错误信息:
<stdin>: In function 'int main()':
<stdin>:14:10: error: call of overloaded 'func(<brace-enclosed initializer list>)' is ambiguous
<stdin>:14:10: note: candidates are:
<stdin>:5:6: note: void func(std::vector<std::basic_string<char> >)
<stdin>:6:6: note: void func(std::vector<std::basic_string<wchar_t> >)
<stdin>:7:6: note: void func(std::initializer_list<std::basic_string<char> >)
<stdin>:8:6: note: void func(std::initializer_list<std::basic_string<wchar_t> …Run Code Online (Sandbox Code Playgroud) 我试图做的就是打印调用给定行的方法堆栈。我从/sf/answers/398963841/答案中得到了代码。稍微重构它以显示问题所在。
#include <windows.h>
#include <iostream>
#include <imagehlp.h>
#include <dbghelp.h>
void printStack( void ) {
HMODULE dbghelp_lib = LoadLibrary("dbghelp.dll");
if (NULL == dbghelp_lib) {
printf("dbghelp.dll failed");
}
HANDLE process = GetCurrentProcess();
if (!SymInitialize( process, NULL, TRUE )) {
printf("SymInitialize failed: %d\n", GetLastError());
abort();
} else SetLastError(0);
void * stack[100];
ULONG FramesToSkip = 0;
ULONG FramesToCapture = 32;
unsigned short frames = CaptureStackBackTrace( FramesToSkip, FramesToCapture, stack, NULL );
SYMBOL_INFO * symbol;
symbol = ( SYMBOL_INFO * )calloc( sizeof( SYMBOL_INFO ) …Run Code Online (Sandbox Code Playgroud) 例:
1010111110110001
0101011100010010
================
1010100010100001
|0 1
-|----
0|0 1
1|0 0
Run Code Online (Sandbox Code Playgroud)
如何在c ++/c ++ 11中执行此操作?
我的意思是lua不在嵌入式应用程序中运行而是在独立脚本语言中运行的情况。
我需要这样的东西PHP_BINARY或sys.executablePython编写的。LUA有可能吗?
c++ ×6
console ×2
debugging ×2
windows ×2
backtrace ×1
batch-file ×1
c ×1
c++11 ×1
command-line ×1
css ×1
css3 ×1
lua ×1
mingw ×1
overloading ×1
php ×1
unicode ×1
variables ×1
winapi ×1
windows-xp ×1
xdebug ×1