Category Archives: C++

C++ || Snippet – Custom “strtok” Function To Split A String Into Tokens Using Multiple Delimiters

The following is a custom “strtok” function which splits a string into individual tokens according to delimiters. So for example, if you had an string

C++ || Simple Tokenizer Lexer Using A Finite State Machine

The following is sample code which demonstrates the implementation of a simple Lexer using a table driven Finite State Machine. In its simplest form, a

C++ || Snippet – How To Send Text Over A Network Using A TCP Connection

The following is sample code which demonstrates the use of the “socket“, “connect“, “bind“, “read“, and “write” function calls for interprocess communication over a network

C++ || Snippet – How To Send Text Over A Network Using A UDP Connection

The following is sample code which demonstrates the use of the “socket“, “bind“, “recvfrom“, and “sendto” function calls for interprocess communication over a network on

C++ || Snippet – Custom Template “ToString” Function For Primitive Data Types

The following is a custom template “ToString” function which converts the value of a primitive data type (i.e: int, double, long, unsigned, char, etc.) to

C++ || Snippet – How To Create A File Of Any Size

The following is sample code which demonstrates how to create a file of any size using the fseek and fwrite function calls. [crayon-597266f646ca3302310745/] QUICK NOTES:

C++ || Snippet – How To Use Memory Mapped Files

The following is sample code which demonstrates the use of the “mmap”, “munmap” and “getpagesize” function calls on Unix based systems. A memory mapped file

C++ || Snippet – How To Display The Size Of A File Using Stat

The following is sample code which demonstrates the use of the “stat” function calls on Unix based systems. The stat function returns information about a

C++ || Snippet – How To Use Message Queues For Interprocess Communication

The following is sample code which demonstrates the use of the msgsnd, msgrcv, and msgget function calls for use with message queues on Unix based

C++ || Snippet – Multi-Process Synchronization Producer Consumer Problem Using Threads

The following is sample code which demonstrates the use of POSIX threads (pthreads), aswell as pthread mutex and condition variables for use on Unix based

C++ || Snippet – How To Create And Use Threads For Interprocess Communication

The following is sample code which demonstrates the use of POSIX threads (pthreads), aswell as the pthread_create, and pthread_join function calls on Unix based systems.

C++ || Snippet – How To Override The Default Signal Handler (CTRL-C)

The following is sample code which demonstrates the use of the “signal” function call on Unix based systems. Signals are interrupts delivered to a process

C++ || Snippet – How To Use Popen & Save Results Into A Character Array

The following is sample code which demonstrates the use of the “popen” function call on Unix based systems. The “popen” function call opens a process

C++ || Snippet – How To Use Fork & Pipe For Interprocess Communication

The following is sample code which demonstrates the use of the fork, read, and write function calls for use with pipes on Unix based systems.