Skip to main content
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
1 vote
1 answer
145 views

Format() Entire Strings (Rather Than Characters)

Background VBA has a Format() function which converts any value to its textual representation. This is useful for numbers and Dates and times, but it can also be used on Strings. Debug.Print Format(&...
Greg's user avatar
  • 3,368
0 votes
1 answer
68 views

Printf command stops working when DEBUG trap is active?

When I set a DEBUG trap in Bash like this: set -o functrace trap 'echo "# $BASH_COMMAND" >&2' DEBUG Suddenly, this function stopped working: getBase() { local base="$1" ...
Maestro's user avatar
  • 9,594
13 votes
3 answers
2k views

Why does a mismatching printf specifier also affect subsequent arguments?

I have a very simple C program where I am printing variables of different sizes. #include <stdio.h> unsigned int long long a; unsigned int c; int main() { a = 0x1111111122222222; c = ...
Krishna's user avatar
  • 1,602
4 votes
1 answer
127 views

how to implement syscalls with newlib nano

im trying to implement syscalls for printf so i defined the functions : #include <stdint.h> #include <sys/stat.h> #include <sys/types.h> #include <errno.h> void usart_init(...
W4ZM's user avatar
  • 81
12 votes
4 answers
2k views

How does printing a union itself and not its member work in C?

I'm making a hashtable in C that I want to contain elements of different types, so I made it return a union that can hold int, float or char *. But when trying to print the union itself out, float ...
Daxxxmp4's user avatar
  • 123
1 vote
1 answer
99 views

printf (inside C code) called from python in google colab. (no output)

printf doesn't output anything google colab cell: %%writefile my_functions.c #include <stdio.h> #include <stdlib.h> void my_void_func() { printf("my_void_func called from C!\n"); ...
D V's user avatar
  • 185
3 votes
0 answers
261 views

Is it possible to disable some print format specifiers? the embedded system i'm working with does not support string output

logging interface is in the header https://gitee.com/openharmony/hiviewdfx_hilog_lite/blob/master/interfaces/native/kits/hilog_lite/hiview_log.h the comment in the header says that * @param fmt ...
tteng little's user avatar
0 votes
0 answers
45 views

Why is my Clang not checking the format string?

#include <stdio.h> //extern int printf(const char* __restrict, ...) __attribute__ ((format (printf, 1, 2))); void test_func(void); void test_func(void) { int test_object = 0; printf(&...
charmoniumQ's user avatar
  • 5,563
4 votes
3 answers
184 views

Trying to exploit the stack content with a format string, but I can't understand where it takes the output from

I am studying for my Computer Security exam and I am on the Format String Bugs section. In the notes there is this code, and I was testing it on my VM: #include <stdio.h> void test(char *arg) { ...
teozzo's user avatar
  • 51
0 votes
0 answers
66 views

issues with "atof" function in MPLAB X IDE v6.25 with XC8 v03.00

I'm working on some code for a PIC microcontroller PIC18F47J53. I'm using MPLAB X IDE v6.25 and the package PIC18F-J_DFP 1.9.170. Both are latest versions. A year ago, I used exactly the same code, ...
Hans Billiet's user avatar
4 votes
2 answers
126 views

awk printf long number padding output incorrect

Arch linux 6.15.7-zen1-1-zen, $ awk -V GNU Awk 5.3.2, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.2, GNU MP 6.3.0) Start with y.csv: 4 2016201820192020 5 20162018201920202023 5 20162018201920202024 5 ...
joharr's user avatar
  • 587
3 votes
2 answers
81 views

What's the OCaml equivalent of C's printf("%.3s"), i.e, specifying a maximum width for a string argument?

In C, one can write: printf("%.3s", "foobar"); To get foo printed as a result (that is, print the initial part of a string). In OCaml, Printf.printf "%.3s" "foobar&...
anol's user avatar
  • 9,364
1 vote
1 answer
121 views

Problems with printing double constants in c

I have codes that look like this #include <float.h> #include <stdio.h> int main(void) { long double x = LDBL_MAX; printf("%Lf ", x); printf("%Lf\n", 1....
leaner18932's user avatar
0 votes
2 answers
131 views

printf special character in interactive shell, but not from shell script

I'm trying to print a special character from a Shell script. printf '\U002F' works in interactive shell, but not from Bash shell script. Shell script keeps printing \u002F. I tried to escape \, but it ...
Faxopita's user avatar
  • 105
4 votes
2 answers
203 views

Can I printf a half-precision floating-point value?

I have a _Float16 half-precision variable named x in my C program, and would like to printf() it. Now, I can write: printf("%f", (double) x);, and this will work; but - can I printf x ...
einpoklum's user avatar
  • 137k

15 30 50 per page
1
2 3 4 5
644
Morty Proxy This is a proxified and sanitized view of the page, visit original site.