Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
1 answer
145 views

vsprintf() does not print warning when having more arguments then specified in format

I was trying the create an error check while creating logs, with a simple logging mechanism. I observed that it is possible use vfprintf(), that it does not print any warning at compile time, that too ...
MrSaiba's user avatar
  • 51
2 votes
4 answers
102 views

Trying to replicate printf behaviour about variadic paramenters

I'm trying to replicate some printf functionality for education purposes, but I've encountered some printf behavior that I'm unable to understand. I'll try explaining with a simple example: have this ...
Lineath's user avatar
  • 43
1 vote
2 answers
1k views

Use printf with args into variadic functions?

I need a function that works like printf, but makes some changes to the fmt string: for example, add at the beginning a string containing the datetime, but the rest, I will maintain the same printf ...
ghiboz's user avatar
  • 7,983
0 votes
0 answers
93 views

C variadic function mystery

I'm finding something strange, but before crying to a compiler bug (!?) I'm very open to let anybody point out whatever I'm doing wrong in the following code... I've isolated the problem, here is a ...
Pyper's user avatar
  • 33
0 votes
2 answers
243 views

Why do my variadic functions in my printf function not work?

I need to recreate the printf function for a school project. My current function works flawlessly, except if there are two arguments. If I do the following: ft_printf("%c%c", 'a', 'b'); it ...
Max's user avatar
  • 17
1 vote
1 answer
271 views

Variadic function process arguments in reverse order. why? [duplicate]

I've crafted a small code to process a variable number of strings, but some how I got these strings processed in reverse order. The expected output is: Jolasd14; actual output is: asdJol14. int ...
practicante's user avatar
4 votes
1 answer
864 views

FFI in Chez Scheme for C functions with variadic arguments (varargs)

I want to write a FFI for printf function of C in Chez Scheme using foreign-procedure. But I cannot figure out what I should put as the signature, since the last argument in printf function is a ...
Reza Hajianpour's user avatar
1 vote
0 answers
199 views

copy va_list parameters to pass to another task

I am in a multithreading embedded environment (FreeRTOS). I need a function like printf, with variadic argumets that instead of output characters, should pack format string and all parameters in an ...
mastupristi's user avatar
  • 1,448
0 votes
2 answers
3k views

How to use Variadic macros with fprintf

I am trying to print logs into a file by writing macros. My macro looks like as shown below: #define LOG(fmt,...){\ FILE *F;\ F = fopen("output.txt","a");\ fprintf(F,fmt " %s %d",...
user1692342's user avatar
  • 5,237
0 votes
1 answer
176 views

How to execute text made using sprintf as code in MATLAB?

I have some code that does a bunch of fourier transforms on a phone number. Right now I'm cutting the phone number into blocks, but I want it to work for any number of blocks. The following code is ...
user3129326's user avatar
15 votes
4 answers
10k views

How do vararg functions find out the number of arguments in machine code?

How can variadic functions like printf find out the number of arguments they got? The amount of arguments obviously isn't passed as a (hidden) parameter (see a call to printf in asm example here). ...
masterxilo's user avatar
  • 2,760
3 votes
5 answers
2k views

how to help programmer write safe and correct printf calls in C?

[Updated organization and content for clarity] The Real Question What would be a good way, for C, to help a programmer, while s/he's typing, write safe and correct calls to project-specific printf-...
talkaboutquality's user avatar