奇怪的铿锵行为。简单的代码段会产生错误的结果

时间:2018-06-17 18:27:03

标签: c scanf

此片段:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# other lines of code
driver.get("https://epicmafia.com/home")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='user[username]']"))).send_keys("FF")
driver.find_element_by_css_selector("input[name='user[password]']").send_keys("FF")
driver.find_element_by_css_selector("input.red[value='Login']").click()

给出了错误的结果。终端没有打印任何内容。调试器显示结果#include <stdio.h> int main() { char cbuf[4], nl; int n; const char *s = "GET\n"; if (sscanf(s, "%3[^\n]%1[\n]%n", cbuf, &nl, &n) < 2) return -1; printf("%s\n", cbuf); return 0; } 具有以下结构:

cbuf

当我在online GDB程序中粘贴此代码时会给出预期结果。它会打印[0] = '\0' [1] = 'E' [2] = 'T'

我的问题是,这种行为的原因是什么?

我的铿锵声版本是3.8.0

0 个答案:

没有答案