Creating a random file and entering some data into it

In this recipe, we will be creating a random file and we will enter some lines of text into it. The random files are structured, and the content in the random file is written via structures. The benefit of creating a file using structures is that we can compute the location of any structure directly and can access any content in the file randomly. The name of the file to be created is passed through command-line arguments.