Message from @why am I 𝓐𝓛𝓘𝓥𝓔

Discord ID: 473822086981484545


2018-07-31 11:55:58 UTC  

why use dead language

2018-07-31 11:57:25 UTC  

@spaqin So when using the write function it returned the mmapedData backwards after the reverseArray function

2018-07-31 11:57:27 UTC  

So that is fine

2018-07-31 11:57:41 UTC  

But then putting that into the file gives a corrupted file that is the same file size

2018-07-31 11:58:05 UTC  

How corrupted

2018-07-31 11:58:12 UTC  

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

2018-07-31 11:58:14 UTC  

@bentech because we make embedded devices

2018-07-31 11:58:16 UTC  

the file size is the same

2018-07-31 11:58:25 UTC  

so the data is certainly there

2018-07-31 11:58:52 UTC  

it's literally supposed to be backwards

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

2018-07-31 11:58:52 UTC  

Did you check the data in the program?

2018-07-31 11:59:07 UTC  

yes, that's what I see with the write() command in the code

2018-07-31 11:59:14 UTC  

it's prints that all out backwards in the terminal

2018-07-31 11:59:17 UTC  

You could've also somehow messed up the params?

2018-07-31 11:59:19 UTC  

looks like your encoding is wack

2018-07-31 11:59:19 UTC  

But I want that in a plain text

2018-07-31 11:59:28 UTC  

Or it could be UTF8

2018-07-31 11:59:31 UTC  

if it's anything except ASCII you can't just reverse the bytes and have it work

2018-07-31 11:59:33 UTC  

Or whatever utf

2018-07-31 11:59:40 UTC  

@Goz3rr no no

2018-07-31 11:59:48 UTC  

```
void reverseArray(char* mmappedData, int start, int end) {
int tmp;
while(start < end) {
tmp = mmappedData[start];
mmappedData[start] = mmappedData[end];
mmappedData[end] = tmp;
start++;
end--;
}
}
```

2018-07-31 11:59:52 UTC  

In place reversal

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