Sign in to follow this  

Problem with FileFront and reading foldernames

This topic is 4110 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[i].foldername); fns[i].isEmpty = FALSE; fns[i].index = i+1; } }*/ return 1; } int main(int argc, char* argv[]){ char name[120]; for(int i = 0; i<MAX_DIRECTORIES_CHECK; i++){ fns[i].isEmpty = TRUE; fns[i].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[i].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

This topic is 4110 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this