   rename
  I wanna do a program:1. search a  folder to find all file name.2. call rename() to rename all file name to other.1.how to do step 1? any function for that? 2.how to d a 2 dimension array?char c[][] or char ** c? stl is not consided. (vector<string> should be good)   
Quote:Original post by derek7I wanna do a program:1. search a  folder to find all file name.2. call rename() to rename all file name to other.1.how to do step 1? any function for that? 2.how to d a 2 dimension array?char c[][] or char ** c? stl is not consided. (vector<string> should be good)There's no way to do it with plain C or C++, you'll need to use platform specific functions (Such as Win32's FindFirstFile() and FindNextFile()) or a library like boost.Both of those methods of doinf 2D arrays will work. If you want to dynamically allocate them though, you'll have to do a loop like so:int nRows = 42;int nCols = 69;char** c = (char**)malloc(sizeof(char*) * nRows);for(int i=0; i<nRows; ++i)   c = (char*)malloc(sizeof(char) * nCols);(Not including error checking)   