Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #160392
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: simple positional printf code review |
| Date | 2021-04-26 18:19 -0700 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <s67oq4$off$1@gioia.aioe.org> (permalink) |
| References | (2 earlier) <s6790c$8uf$2@dont-email.me> <f024614a-ed9b-48d9-86e1-041a649f185fn@googlegroups.com> <871rawhhxu.fsf@bsb.me.uk> <dedb025c-1fd8-4816-860a-c02c8e23a87en@googlegroups.com> <87h7jsftap.fsf@bsb.me.uk> |
On 4/26/2021 5:46 PM, Ben Bacarisse wrote:
> Thiago Adams <thiago.adams@gmail.com> writes:
>
>> On Monday, April 26, 2021 at 6:09:12 PM UTC-3, Ben Bacarisse wrote:
>>> Thiago Adams <thiago...@gmail.com> writes:
>>>
>>>> On Monday, April 26, 2021 at 5:49:23 PM UTC-3, Lew Pitcher wrote:
>>>>> damn keyboard, switched the questionmark and dollarsign on me :-S
>>>> [..]
>>>>>> printf("%2$*1$d", width, num);
>>>>
>>>> This worked at Windows..but snprintf apparently is not implemented on
>>>> windows.
>>> That may be due to MS pushing the snprintf_s version. Have you tried
>>> that? (I can't -- no access to an MS C ompiler.)
>>
>> In linux the same printf works for positional arguments...
>> in windows we need to use another function called printf_p
>> in windows normal printf("%2$*1$d", width, num); does not work.
>
> Sorry, we've got a bit lost. I was only commenting on "snprintf
> apparently is not implemented on windows". I was not referring to
> whether any of these functions implemented positional parameters. I
> seem to remember someone saying that a lot of C functions are now hidden
> by default because MS want you to use the _s versions.
They are there, but you get a compile error. You need to use
_CRT_SECURE_NO_WARNINGS.
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-160
>
> Sorry if this side point was not clear. And double sorry if I am wrong
> about it altogether -- it is second hand information.
>
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
simple positional printf code review Thiago Adams <thiago.adams@gmail.com> - 2021-04-26 13:29 -0700
Re: simple positional printf code review Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-04-26 20:39 +0000
Re: simple positional printf code review Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-04-26 20:49 +0000
Re: simple positional printf code review Thiago Adams <thiago.adams@gmail.com> - 2021-04-26 14:00 -0700
Re: simple positional printf code review Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-26 22:09 +0100
Re: simple positional printf code review Thiago Adams <thiago.adams@gmail.com> - 2021-04-26 14:18 -0700
Re: simple positional printf code review Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-27 01:46 +0100
Re: simple positional printf code review "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-26 18:19 -0700
Re: simple positional printf code review Thiago Adams <thiago.adams@gmail.com> - 2021-04-27 04:44 -0700
Re: simple positional printf code review Geoff <geoff@invalid.invalid> - 2021-04-26 17:58 -0700
Re: simple positional printf code review Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-27 15:58 +0000
Re: simple positional printf code review Thiago Adams <thiago.adams@gmail.com> - 2021-04-26 13:53 -0700
Re: simple positional printf code review Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-26 21:53 +0000
csiph-web