Jump to content
  • Advertisement
Sign in to follow this  
derek7

rename

This topic is 4401 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by derek7
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)
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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!