# Remove the last char from an IOBuffer in-place?

**URL:** https://discourse.julialang.org/t/remove-the-last-char-from-an-iobuffer-in-place/109128
**Category:** New to Julia
**Created:** [January 23, 2024, 8:25am UTC](https://discourse.julialang.org/t/remove-the-last-char-from-an-iobuffer-in-place/109128 "2024-01-23T08:25:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![putianyi888](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/putianyi888/32/32279_2.png) [@putianyi888](https://discourse.julialang.org/u/putianyi888)
#### Post date: [January 23, 2024, 8:25am UTC](https://discourse.julialang.org/t/remove-the-last-char-from-an-iobuffer-in-place/109128/1 "2024-01-23T08:25:09Z")

</div>

I’m trying to append to a string so I use an IOBuffer as it operates in place. I tried to print `\b` but it’s reserved in the IOBuffer:

```julia
julia> io=IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

julia> print(io,"abc\bd")

julia> String(take!(io))
"abc\bd"

```

---

<div class="post-metadata">

### Author: ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)
#### Post date: [February 13, 2024, 3:21am UTC](https://discourse.julialang.org/t/remove-the-last-char-from-an-iobuffer-in-place/109128/2 "2024-02-13T03:21:50Z")

</div>

The function `truncate` can be used to change the length of a file
