PvP in the zombie apocalypse. Limited resources. Endless zombies. Last team alive wins.

Post tutorial Report RSS Parsing a windows directory in a Win32 C++ application

Parsing directories and subdirectories for wanted files.

Posted by on - Basic Client Side Coding

Let’s say you are working on a quest based game. You will try to create some kind of framework to parse specific files, which holds the content for the quest, with available actions, the story, etc. In other words, you will create a scripting language for you quests. Let’s say you create simple .txt files which afterwards you will encrypt and give another type like .qst. It would be really bad idea to go hardcode all of the parsing and linking. In this tutorial we will in the first time parse all files in a directory and keep them in a container. The name of the file will be the quests name, which we will use as the key value to search. The value will be the file itself. You can probably already guess we will use a std::map for this, because of the searching algorithm available in the algorithm library. What’s the idea behind this: In your level editor you need to create an entity which will launch a quest. On launch, you will have to specify the quests name. By this quests name you will need the file where all quest specifications are stored. I will show you how to parse the directory that holds the quests, store them and how the retrieve the file so you can parse it and do whatever you need to do.
Off course, you won’t get stuck after 5 quests, you will have a lot at the end. Therefore in the second part we will parse a directory with sub directories, so you can group your quests by level for example.

Click on the link below for the tutorial:

Parsing a windows directory in a Win32 C++ application

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: