Forums WoW Modding Support Archives TrinityCore Discord Archives [DiscordArchive] Dose the c++ std:string have a end char like '\0'?

[DiscordArchive] Dose the c++ std:string have a end char like '\0'?

[DiscordArchive] Dose the c++ std:string have a end char like '\0'?

rektbyfaith
Administrator
0
03-15-2021, 08:02 AM
#1
Archived author: JORGIE • Posted: 2021-03-15T08:02:12.815000+00:00
Original source

Dose the c++ stdConfusedtring have a end char like '\0'?
rektbyfaith
03-15-2021, 08:02 AM #1

Archived author: JORGIE • Posted: 2021-03-15T08:02:12.815000+00:00
Original source

Dose the c++ stdConfusedtring have a end char like '\0'?

rektbyfaith
Administrator
0
03-15-2021, 08:03 AM
#2
Archived author: MaxtorCoder • Posted: 2021-03-15T08:03:38.158000+00:00
Original source

Yes, it's null terminated
rektbyfaith
03-15-2021, 08:03 AM #2

Archived author: MaxtorCoder • Posted: 2021-03-15T08:03:38.158000+00:00
Original source

Yes, it's null terminated

rektbyfaith
Administrator
0
03-15-2021, 08:04 AM
#3
Archived author: JORGIE • Posted: 2021-03-15T08:04:03.443000+00:00
Original source

Yes the c++ append the '\0' . I tested.
rektbyfaith
03-15-2021, 08:04 AM #3

Archived author: JORGIE • Posted: 2021-03-15T08:04:03.443000+00:00
Original source

Yes the c++ append the '\0' . I tested.

rektbyfaith
Administrator
0
03-15-2021, 08:05 AM
#4
Archived author: JORGIE • Posted: 2021-03-15T08:05:48.204000+00:00
Original source

2F 00 00 00 78 9C F3 0A F6 F7 0B 4A 4D CC C9 F5 C9 2C 2E 09 4E 2D 2A 4B 2D F2 0C 70 4C 49 29 4A 2D 2E 4E 2D B6 AA 56 2A 49 2D 2E 51 B2 82 50 B5 0C 00 A1 15 10 EA

30 00 00 00 78 9C F3 0A F6 F7 0B 4A 4D CC C9 F5 C9 2C 2E 09 4E 2D 2A 4B 2D F2 0C 70 4C 49 29 4A 2D 2E 4E 2D B6 AA 56 2A 49 2D 2E 51 B2 82 50 B5 0C 00 A1
rektbyfaith
03-15-2021, 08:05 AM #4

Archived author: JORGIE • Posted: 2021-03-15T08:05:48.204000+00:00
Original source

2F 00 00 00 78 9C F3 0A F6 F7 0B 4A 4D CC C9 F5 C9 2C 2E 09 4E 2D 2A 4B 2D F2 0C 70 4C 49 29 4A 2D 2E 4E 2D B6 AA 56 2A 49 2D 2E 51 B2 82 50 B5 0C 00 A1 15 10 EA

30 00 00 00 78 9C F3 0A F6 F7 0B 4A 4D CC C9 F5 C9 2C 2E 09 4E 2D 2A 4B 2D F2 0C 70 4C 49 29 4A 2D 2E 4E 2D B6 AA 56 2A 49 2D 2E 51 B2 82 50 B5 0C 00 A1

rektbyfaith
Administrator
0
03-15-2021, 08:06 AM
#5
Archived author: JORGIE • Posted: 2021-03-15T08:06:01.873000+00:00
Original source

what is 15 10 EA
rektbyfaith
03-15-2021, 08:06 AM #5

Archived author: JORGIE • Posted: 2021-03-15T08:06:01.873000+00:00
Original source

what is 15 10 EA

rektbyfaith
Administrator
0
03-15-2021, 08:07 AM
#6
Archived author: JORGIE • Posted: 2021-03-15T08:07:09.102000+00:00
Original source

```java

public static void main(String[] args) {
String value = "JSONRealmListServerIPAddresses:{\"test\":\"test\"}\0";
byte[] valueBytes = value.getBytes(StandardCharsets.UTF_8);
byte[] outBytes = new byte[valueBytes.length + 4];
ByteBuffer.wrap(outBytes).order(ByteOrder.LITTLE_ENDIAN).putInt(valueBytes.length + 1);
int compressed = CompressDeflate.compress(valueBytes, 0, valueBytes.length, outBytes, 4);
for (int i = 0; i < compressed; i++) {
System.out.printf("%02X ",outBytes[i]);
}
}

```
rektbyfaith
03-15-2021, 08:07 AM #6

Archived author: JORGIE • Posted: 2021-03-15T08:07:09.102000+00:00
Original source

```java

public static void main(String[] args) {
String value = "JSONRealmListServerIPAddresses:{\"test\":\"test\"}\0";
byte[] valueBytes = value.getBytes(StandardCharsets.UTF_8);
byte[] outBytes = new byte[valueBytes.length + 4];
ByteBuffer.wrap(outBytes).order(ByteOrder.LITTLE_ENDIAN).putInt(valueBytes.length + 1);
int compressed = CompressDeflate.compress(valueBytes, 0, valueBytes.length, outBytes, 4);
for (int i = 0; i < compressed; i++) {
System.out.printf("%02X ",outBytes[i]);
}
}

```

rektbyfaith
Administrator
0
03-15-2021, 08:10 AM
#7
Archived author: JORGIE • Posted: 2021-03-15T08:10:00.369000+00:00
Original source

```cpp
*reinterpret_cast<uint32*>(compressed.data()) = uint32(json.length() + 1);

```
rektbyfaith
03-15-2021, 08:10 AM #7

Archived author: JORGIE • Posted: 2021-03-15T08:10:00.369000+00:00
Original source

```cpp
*reinterpret_cast<uint32*>(compressed.data()) = uint32(json.length() + 1);

```

rektbyfaith
Administrator
0
03-15-2021, 08:11 AM
#8
Archived author: JORGIE • Posted: 2021-03-15T08:11:29.371000+00:00
Original source

Look this code, Why do have to json.length() + 1
rektbyfaith
03-15-2021, 08:11 AM #8

Archived author: JORGIE • Posted: 2021-03-15T08:11:29.371000+00:00
Original source

Look this code, Why do have to json.length() + 1

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)