Posts Tagged stream

C++ For C# Developers: Part 50 – I/O Library

Tags: , , ,

We’ve seen a bit of I/O in the C Standard Library already, but this isn’t C++’s main way to perform I/O. Today we’ll look at the “streams” API that’s designed around C++’s support for strong types and overloaded operators rather than facilities like “format strings.” We’ll also see how to write the canonical “Hello, world!” program in C++ and how to finally implement DebugLog!

Read the rest of this article »

No Comments

Sub-Byte Sizes: Part 2

Tags: , ,

Today we continue to explore how we can store values in less than a byte. We’ll expand the BitStream struct with the capability to write values in addition to just reading them. Read on to see how to implement this functionality and for the full source code which you can use in your projects.

Read the rest of this article »

2 Comments

Sub-Byte Sizes: Part 1

Tags: , ,

The smallest a C# type can be is one byte. The byte type and and an empty struct are examples of this. But what if we want to store data in less than a byte to improve performance such as load times and CPU cache utilization? Today’s article does just this by packing at the bit level!

Read the rest of this article »

2 Comments

File I/O Performance Tips

Tags: , , , , , ,

At some point, every project ends up reading or writing to the file system. If you do anything more than storing a single blob of bytes (e.g. JSON text) then you’ll need to be very careful about performance. It’s easy to accidentally write code that takes way longer to read and write than it should and you won’t get any help from the compiler or from Unity. Today’s article reveals some of these traps so you won’t fall into them!

Read the rest of this article »

13 Comments