Message from @why am I 𝓐𝓛𝓘𝓥𝓔

Discord ID: 473822861732216844


2018-07-31 11:59:56 UTC  

you are reading bytes

2018-07-31 11:59:57 UTC  

a char is a byte

2018-07-31 12:00:02 UTC  

No bits were turned in reverse

2018-07-31 12:00:23 UTC  

Pass me the fwrite incantation you use

2018-07-31 12:00:35 UTC  

incantation lol

2018-07-31 12:00:37 UTC  

```
fwrite(mmappedData, 1, filesize, f);
```

2018-07-31 12:00:37 UTC  

im stealing that

2018-07-31 12:00:44 UTC  

Can't fuck that up lmao

2018-07-31 12:00:53 UTC  

mmapedData is a char* array from a mmap() command

2018-07-31 12:01:00 UTC  

1 is the start of the array

2018-07-31 12:01:03 UTC  

Give it a simple file first

2018-07-31 12:01:11 UTC  

compare your two files in a hex editor

2018-07-31 12:01:12 UTC  

ah ok sorry

2018-07-31 12:01:14 UTC  

one moment

2018-07-31 12:01:16 UTC  

instead of a text editor

2018-07-31 12:01:17 UTC  

to begin with

2018-07-31 12:01:22 UTC  

Tru

2018-07-31 12:01:34 UTC  

hav no idea

2018-07-31 12:01:46 UTC  

you probably succesfully reversed all bytes, but your text editor is interpreting it as the wrong encoding

2018-07-31 12:02:09 UTC  

so that's the result of the write

https://cdn.discordapp.com/attachments/189467888657235970/473822677828763648/unknown.png

2018-07-31 12:02:53 UTC  

And here's what happens in fwrite

https://cdn.discordapp.com/attachments/189467888657235970/473822861732216843/unknown.png

2018-07-31 12:03:07 UTC  

It's plain text

2018-07-31 12:03:14 UTC  

How could there be an encoding fuck up

2018-07-31 12:03:21 UTC  

Can I force it to output plain text

2018-07-31 12:03:28 UTC  

that's not how files work

2018-07-31 12:04:45 UTC  

you output bytes

2018-07-31 12:04:51 UTC  

it's up to the reading program to interpret them

2018-07-31 12:05:53 UTC  

so then why is it ok with write, but then i cannot use that in fwrite?

2018-07-31 12:06:15 UTC  

because your terminal correctly displays it as ascii

2018-07-31 12:06:49 UTC  

gedit probably does with utf8 or something and you happened to end up in the chink codepoints

2018-07-31 12:07:13 UTC  

actually not utf8

2018-07-31 12:07:15 UTC  

but something

2018-07-31 12:07:27 UTC  

Can't I just take the write() output, but use that instead?

2018-07-31 12:07:32 UTC  

Cause the write() is completely fine

2018-07-31 12:07:39 UTC  

no

2018-07-31 12:07:40 UTC  

listen

2018-07-31 12:07:44 UTC  

the output is the same in raw bytes

2018-07-31 12:07:46 UTC  

most likely

2018-07-31 12:07:49 UTC  

yes

2018-07-31 12:07:50 UTC  

confirm this with a hex editor

2018-07-31 12:08:00 UTC  

xxd or whatever