首页 \ 问答 \ 我将如何在C中编写一个新的我自己的格式说明符?(How would i write a new my own format specifier in C?)

我将如何在C中编写一个新的我自己的格式说明符?(How would i write a new my own format specifier in C?)

是否有可能在C中编写一个新的格式说明符? 例如,可以说,%g是一个格式说明符,它以无符号整数等价的形式打印出ABCD格式的IP地址。

int ip_addr = Some integer

printf("ip address = %g", ip_addr);

输出:以ABCD格式打印IP地址


Is it possible to write a new format specifier in C ? For example, lets say, %g is a format specifier which prints the ip address in A.B.C.D format from the unsigned integer equivalent.

int ip_addr = Some integer

printf("ip address = %g", ip_addr);

output: prints ip address in A.B.C.D format


原文:https://stackoverflow.com/questions/34638466
更新时间:2023-07-21 16:07

最满意答案

TreeModel只能有一个根节点,但在显示树时可以使用JTree.setRootVisible()隐藏根节点。 修改您的模型以使其包含每个文件系统根(C:\,D:\,E:\等)的虚拟根节点,并在您的JTree上调用JTree.setRootVisible(false)


A TreeModel can only have one root node, but you can use JTree.setRootVisible() to hide the root node when displaying the tree. Modify your model to have a virtual root node that contains each filesystem root (C:\, D:\, E:\, etc.), and call JTree.setRootVisible(false) on your JTree.

相关问答

更多
  • 如果将内存中的对象视为树,则“根”将是根节点 - 您的程序可以立即访问每个对象。 Person p = new Person(); p.car = new Car(RED); p.car.engine = new Engine(); p.car.horn = new AnnoyingHorn(); 有四个对象 一个人,一辆红色的汽车,它的发动机和喇叭。 绘制参考图: Person [p] | Car (red) / \ Engine An ...
  • “多根”只是意味着你从第一级开始并完全省略“真正的”根。 所以, Root1 (1, 4) Node1 (2, 3) Root2 (5, 12) Node21 (6, 7) Node22 (8, 11) Node221 (9, 10) 不要在左/右索引上重新启动序列; 你会走进一个受伤的世界。 就你的过滤器问题而言,它纯粹是一个表达问题。 有不同的方法来处理这个问题; 我过去使用的那个是显示通向节点的路径中的所有节点满足您的过滤条件但突出显示“过滤”节点并使它们不可操作 ...
  • 如果您的订单之前存在物品,这意味着只有一件事:订单和物品是两个不同的聚合根,因此可以用不同的方式处理。 因此,这解决了您的问题:您需要两个存储库,一个用于订单,一个用于项目。 在处理Orders内部商品的其他任何环境中,formrs都不能在后者之前存在。 无论如何,这需要一些保存工作,因为如果添加/删除了一个项目,您必须检查每个订单。 If you have Items that exists before Orders, this means only one thing: Orders and Item ...
  • TreeModel只能有一个根节点,但在显示树时可以使用JTree.setRootVisible()隐藏根节点。 修改您的模型以使其包含每个文件系统根(C:\,D:\,E:\等)的虚拟根节点,并在您的JTree上调用JTree.setRootVisible(false) 。 A TreeModel can only have one root node, but you can use JTree.setRootVisible() to hide the root node when displaying ...
  • 你可以否定你的整个逻辑表达! : If[! (((0 < spfn[[i]]) && (0 < spfn[[i + 1]])) || ((spfw[[i]] < 0) && (spfw[[i + 1]] < 0))), Print["1) exist some roots on: {", spx[[i]], ";", spx[[i + 1]], "}"]] 注意我添加了一组括号,以便否定适用于整个表达式 您可以交替使用If的第三个参数: If[((0 < spfn[[i]]) ...
  • 尝试将您的for循环更改为: ctr=1; for i = 1:100 if abs(y1(i) - y2(i)) <= tol y_intersect(ctr) = y2(i); x_intercept(ctr) = x(i); ctr=ctr+1; end end Try changing your for loop to: ctr=1; for i = 1:100 if abs(y1(i) - y2(i)) <= tol ...
  • 绘制 besselj和besseli把你所谓的omega作为他们的第二个参数,所以为了绘制你的功能你应该尝试像 m=0; k=1; omega=0:0.02:10; Jm=besselj(m,omega); Ik=besseli(k,omega); Jk=besselj(k,omega); Im=besseli(m,omega); g=Jm.*Ik+Im.*Jk; plot(omega,g); hold all; plot(omega,0,'k'); axis([min(omega) max(omega) ...
  • 计算多项式及其导数之间的gcd 。 当且仅当它是gcd的根时,根才是多个。 这可能会降低程度,这将增加您找到多个根的机会。 有一些策略要遵循: 如果gcd的程度不大于2,则可以使用封闭的公式作为其根。 如果多项式具有整数系数,则可以使用Rational根定理来查找gcd的合理根,如果有的话。 对于一般情况,您可以使用Sturm定理将区间中的所有根分离为您想要的小,这是实现无限精度的一种方法。 Compute the gcd between the polynomial and its derivative. ...
  • 以下是3种方法的比较: 循环遍历所有行,每行使用roots 。 基于YBE使用块对角矩阵的思想,完全无效的方法,使用sparse作为中间值 简单循环遍历所有行,但这次使用来自roots “内联”代码。 代码: %// The polynomials m = 15; n = 8; N = 1e3; X = rand(m,n); %// Simplest approach tic for mm = 1:N R = zeros(n-1,m); for ii = 1:m R( ...
  • 老实说,SemanticGraph有许多历史代码,这些代码的最初用法是在RTE(识别文本蕴涵)系统中,而不是语法依赖解析,因此不要过多地阅读。 但是,然而,存在各种相当自然的用例(例如,片段解析或语义图转换操作的输出),这可能导致断开的图形,并因此导致多个根。 In all honesty, SemanticGraph has a lot of historical code which was motivated by its initial use in an RTE (Recognizing Text ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)