using System;
using System.IO.MemoryMappedFiles;
namespace client
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Memory mapped file reader started");
            
            using (var file = MemoryMappedFile.OpenExisting("myFile"))
            {
                using (var reader = file.CreateViewAccessor(0, 24))
                {
                    var bytes = new byte[24];
                    reader.ReadArray<byte>(0, bytes, 0, bytes.Length);

                    Console.WriteLine("Reading bytes");
                    for (var i = 0; i < bytes.Length; i++)
                        Console.Write((char)bytes[i] + " ");

                    Console.WriteLine(string.Empty);
                }
            }

            Console.WriteLine("Press any key to exit ...");
            Console.ReadLine();
        }
    }
}
