card->nu-6ren">
gpt4 book ai didi

c - sprintf中的pcmC%iD%ip参数

转载 作者:太空宇宙 更新时间:2023-11-04 07:33:19 24 4
gpt4 key购买 nike

这行代码会做什么。

pcm->card->numberpcm->device都是int

char str[16];

sprintf(str, "pcmC%iD%ip", pcm->card->number, pcm->device);

它取自 android/kernel/sound/core/pcm.c。

最佳答案

截至the description of sprintf()fprintf() , %i

The int argument is converted to a signed decimal in the style [-]dddd. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it will be expanded with leading zeros. The default precision is 1. The result of converting 0 with an explicit precision of 0 is no characters.

所以结果是例如pcmC12D23p 如果 pcm->card->number == 12pcm->device == 23

关于c - sprintf中的pcmC%iD%ip参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11290355/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com