6 Reusable Code Snippet Topics

Remove Filter
Member Avatar for Ancient Dragon

I previously posted an MS-Windows example program about how to recursively search folders and create a list of their filename. This program is similar in concept but is for linux. It c++ and uses std::string and std::vector classes to hold the strings. When the program encounters a directory it will …

Member Avatar for Ancient Dragon
0
953
Member Avatar for Ancient Dragon

short program that will build a stl::list of directory names and all the files they contain. recursively calls itself when a new directory is encountered. This has been compiled with both VC++ 6.0 and Dev-Shed compiles on MS-Windows XP Pro. It will not work on *nix or probably MAC computers. …

Member Avatar for ll_MORTAL_ll
0
854
Member Avatar for Ancient Dragon

The idea for this came from another thread in the C++ forum that wanted to duplicate the _getdelim() function that is supported by GNU compilers g++. I made one major change in that this version does not allocate new memory every time it is called, which is grossly inefficient. Instead, …

Member Avatar for Ancient Dragon
2
318
Member Avatar for Ancient Dragon

This shows how to get the size of all the files in a folder, and all its sub-folders on MS-Windows operating system. It uses recursion to transverse all the directories, and return a 64-bit integer. It was compiled with VC++ 2008 Express and Code::Blocks Version 8.02 with MinGW compiler.

Member Avatar for Ancient Dragon
5
5K
Member Avatar for Ancient Dragon

This demonstrates how to get a list of your computer's logical drive letters under the MS-Windows operating system.

Member Avatar for Ancient Dragon
2
926
Member Avatar for Ancient Dragon

This is a simple example of how to delete a line from a text file. In order to do that you have to completely rewrite the file, leaving out the line(s) you want to delete. First open the input file, then open an output file (doesn't matter what filename you …

Member Avatar for majestic0110
0
11K

The End.