# How to convert FArchive to and from bytes?

**URL:** <https://forums.unrealengine.com/t/how-to-convert-farchive-to-and-from-bytes/1189378>\
**Category:** Programming & Scripting\
**Tags:** serialization, unreal-engine, question, CPP\
**Created:** [June 5, 2023, 10:03am UTC](https://forums.unrealengine.com/t/how-to-convert-farchive-to-and-from-bytes/1189378 "2023-06-05T10:03:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manking-1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Manking-1](https://forums.unrealengine.com/u/Manking-1)\
**Post date:** [June 5, 2023, 10:03am UTC](https://forums.unrealengine.com/t/how-to-convert-farchive-to-and-from-bytes/1189378/1 "2023-06-05T10:03:34Z")

</div>

Hello!

How to save and load FArchive from to bytes or string? C++.

example:

```auto
	FDateTime dt = FDateTime::Now();
	
	FArchive arch;
	arch << dt; // save time to arch

	saveToDisk(arch.toByte());
	FArchive loaded = loadFromDisk();

	FDateTime restoredTime = loaded.deserialize<FDateTime>();

```
