发现一个好玩的,可以调试一些循环逻辑时 进行一下clr动作,方便阅读
const char clr[] = { 27, '[', '2', 'J', '\0' };
const char topLeft[] = { 27, '[', '1', ';', '1', 'H','\0' };
/* Clear screen and move to top left */
printf("%s%s", clr, topLeft);
printf("\nPort statistics ====================================");
本文介绍了一种使用CLR技巧来优化循环逻辑调试的方法,通过定义特定字符数组实现屏幕清除和光标定位,便于在调试过程中清晰展示程序状态,特别适合于控制台应用程序的开发。
2万+

被折叠的 条评论
为什么被折叠?



