Jump to content
  • Advertisement
Sign in to follow this  
Ragnaros

Problem with FileFront and reading foldernames

This topic is 4326 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

Hiya, I'm making a program that'll copy random music directories (being cd's) onto my telephone memorycard. To test the basics, I first programmed a consoleapp that'll index all the dirs of my musicfolder. Below is the code thus far: #include "stdafx.h" #include "windows.h" #include <iostream.h> #include <string.h> #define MAX_DIRECTORIES_CHECK 200 typedef struct{ int index; bool isEmpty; char foldername[120]; }foldernamestruct; foldernamestruct fns[MAX_DIRECTORIES_CHECK]; int listDirectories(char* directory){ HANDLE hFile; WIN32_FIND_DATA FileInformation; hFile = ::FindFirstFile(directory, &FileInformation); if(hFile == INVALID_HANDLE_VALUE) return 3; strcpy(FileInformation.cFileName, fns[0].foldername); fns[0].isEmpty = 0; fns[0].index = 1; printf ("First file name is %s.\n", FileInformation.cFileName); printf(directory); printf(FileInformation.cFileName); printf("\n"); printf(fns[0].foldername); printf("\n"); /*for(int i = 1; i<MAX_DIRECTORIES_CHECK;i++){ if(::FindNextFile(hFile, &FileInformation)==FALSE){ for(int j = i; j<MAX_DIRECTORIES_CHECK;j++) fns[j].isEmpty = TRUE; break; } else{ strcpy(FileInformation.cFileName, fns.foldername); fns.isEmpty = FALSE; fns.index = i+1; } }*/ return 1; } int main(int argc, char* argv[]){ char name[120]; for(int i = 0; i<MAX_DIRECTORIES_CHECK; i++){ fns.isEmpty = TRUE; fns.index = -1; } if(listDirectories("C:\\Documents and Settings\\User\\My documents\\My music")!=1) return 1; //printf("Found Handle \n\n"); /*for(i=0;i<MAX_DIRECTORIES_CHECK;i++){ strcpy(fns.foldername, name); printf(name); printf("\n"); }*/ cin >> name[4]; return 0; } Now, I tried to test the whole by printing the foldernames using printf(), but why won't this work :doh: Have I done something wrong? Can someone help me find the answer... Thanks

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!