简体   繁体   English

C printf格式:在这种情况下,“。”和“|”是什么意思?

[英]C printf formatting: What does “.” and “|” mean in this context?

I'm taking a security course and am having trouble understanding this code due to a lack of understanding of the C programming language. 由于缺乏对C编程语言的理解,我正在学习安全课程并且无法理解这些代码。

printf  ("%08x.%08x.%08x.%08x|%s|");

I was told that this code should move along the stack until a pointer to a function is found. 我被告知这个代码应该沿着堆栈移动,直到找到一个指向函数的指针。

I thought the . 我以为. was just an indicator of precision of output, so I don't know what this means in this context since there are indicators of precision? 只是输出精度的一个指标,所以我不知道这是什么意思,因为有精确指标?

Also, I don't understand what the | 另外,我不明白是什么| means, and I can't find it in the C documentation. 意思是,我在C文档中找不到它。

The symbols have no special meaning here since they are outside of a format specifier, they are simply output literally. 这些符号在这里没有特殊含义,因为它们在格式说明符之外,它们只是字面输出。 Note however that you haven't provided all the arguments that printf expects so it will instead print 5 values that happen to be on the stack. 但请注意,您没有提供printf期望的所有参数,因此它将打印出恰好位于堆栈上的5个值。

In this string the . 在这个字符串中。 and | 和| characters are just outputted. 字符只是输出。 The dots acted as separators for hex strings and the pipes highlighting a string. 点作为十六进制字符串的分隔符和突出显示字符串的管道。

The dots are only considered an indicator of precession if they appear after the % sign and before the format specifier, for example %4.2f . 如果点出现在%符号之后和格式说明符之前,例如%4.2f ,则这些点仅被视为进动的指示符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM