# \#printf

**URL:** https://discuss.ocaml.org/tag/printf/335.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Ocaml IO - Printing Contents of a buffer](https://discuss.ocaml.org/t/ocaml-io-printing-contents-of-a-buffer/15316)

<div class="topic-metadata">

**Author:** [@dibri](https://discuss.ocaml.org/u/dibri)\
**Replies:** 4\
**Last updated:** [September 21, 2024, 9:35am UTC](https://discuss.ocaml.org/t/ocaml-io-printing-contents-of-a-buffer/15316 "2024-09-21T09:35:28Z")

</div>

I am still learning ocaml and have run into an issue printing the contents of a buffer to stdout (or anything to be honest). I have tried using the buffered channels and string conversions but nothing seems to work. Even…

---

## [Print a rational number in binary format](https://discuss.ocaml.org/t/print-a-rational-number-in-binary-format/13643)

<div class="topic-metadata">

**Author:** [@UnixJunkie](https://discuss.ocaml.org/u/UnixJunkie)\
**Replies:** 2\
**Last updated:** [December 15, 2023, 9:15am UTC](https://discuss.ocaml.org/t/print-a-rational-number-in-binary-format/13643 "2023-12-15T09:15:45Z")

</div>

I have a number x such that 0 \<= x \< 1.0. I would like to print x in binary format. e.g. x=1/1024 prints “0.0000000001” x=1/2 prints “0.1” Am I right that the stdlib’s Printf “only” supports octal, decimal and hexade…

---

## [Printf.printf "uri: %a" Uri.pp Uri.empty](https://discuss.ocaml.org/t/printf-printf-uri-a-uri-pp-uri-empty/11810)

<div class="topic-metadata">

**Author:** [@mro](https://discuss.ocaml.org/u/mro)\
**Replies:** 4\
**Last updated:** [April 1, 2023, 3:32pm UTC](https://discuss.ocaml.org/t/printf-printf-uri-a-uri-pp-uri-empty/11810 "2023-04-01T15:32:13Z")

</div>

gives me Error: This expression has type Format.formatter -\> Uri.t -\> unit but an expression was expected of type out\_channel -\> 'a -\> unit Type Format.formatter is not compatible with type out\_channel ho…

---

## [Named arguments to printf format?](https://discuss.ocaml.org/t/named-arguments-to-printf-format/10904)

<div class="topic-metadata">

**Author:** [@olleharstedt](https://discuss.ocaml.org/u/olleharstedt)\
**Replies:** 2\
**Last updated:** [December 3, 2022, 9:33am UTC](https://discuss.ocaml.org/t/named-arguments-to-printf-format/10904 "2022-12-03T09:33:24Z")

</div>

Can’t find an up-to-date or opam package template engine, so maybe printf format is “good enough”? I need something else than just %s - my strings are getting bigger, and it gets harder to keep track of all arguments. T…

---

## [Pretty printing binary ints](https://discuss.ocaml.org/t/pretty-printing-binary-ints/9062)

<div class="topic-metadata">

**Author:** [@ifazk](https://discuss.ocaml.org/u/ifazk)\
**Replies:** 14\
**Last updated:** [November 1, 2022, 1:12pm UTC](https://discuss.ocaml.org/t/pretty-printing-binary-ints/9062 "2022-11-01T13:12:07Z")

</div>

Stdlib’s Printf allows you to print ints as unsigned octals or hexadecimals, but not as unsigned binary integers. Does anyone have a library that can pretty print ints as binary ints? I’m in the middle of writing one, b…

---

## [\[ANN\] pp-binary-ints 0.1.1](https://discuss.ocaml.org/t/ann-pp-binary-ints-0-1-1/9080)

<div class="topic-metadata">

**Author:** [@ifazk](https://discuss.ocaml.org/u/ifazk)\
**Replies:** 0\
**Last updated:** [January 1, 2022, 12:55am UTC](https://discuss.ocaml.org/t/ann-pp-binary-ints-0-1-1/9080 "2022-01-01T00:55:45Z")

</div>

Tired of printing octals and hexadecimals and then mentally converting them to bits. Ever wanted to just see the bits in an int? Now you can! Just run opam install pp-binary-ints and off you go: # Pp\_binary\_ints.Int.to…

---

## [Obtaining the necessary type for format strings + arguments](https://discuss.ocaml.org/t/obtaining-the-necessary-type-for-format-strings-arguments/7070)

<div class="topic-metadata">

**Author:** [@cemerick](https://discuss.ocaml.org/u/cemerick)\
**Replies:** 7\
**Last updated:** [January 11, 2021, 5:49pm UTC](https://discuss.ocaml.org/t/obtaining-the-necessary-type-for-format-strings-arguments/7070 "2021-01-11T17:49:27Z")

</div>

I have need of a way to print using any existing printer, with the output stripped of all cuts, linebreaks, and indents (think of presenting messages containing probably-small bits of pretty-printed data to users in conf…

---

## [Redefine the type format of module CamlinternalFormatBasics?](https://discuss.ocaml.org/t/redefine-the-type-format-of-module-camlinternalformatbasics/4518)

<div class="topic-metadata">

**Author:** [@Luc\_ML](https://discuss.ocaml.org/u/Luc_ML)\
**Replies:** 7\
**Last updated:** [October 9, 2019, 7:55pm UTC](https://discuss.ocaml.org/t/redefine-the-type-format-of-module-camlinternalformatbasics/4518 "2019-10-09T19:55:32Z")

</div>

How do you redefine the type format from CamlinternalFormatBasics module? I tried to redefine the type as I redefine, say, the value map of the module List (include, with type, w/o a new module, etc.). This is for usin…
