Hello everyone;
For my FTP program, when i display all the files and directories on the server i want the directories to be displayed at the top, and the files to follow.
while(InternetFindNextFile(hFindFile,&dwFlags)) {
if( (dwFlags.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY ) {
sprintf(DirName,"%s <DIR> ",dwFlags.cFileName);
SendMessage (ServerFilesLST,LB_ADDSTRING, 0, (LPARAM)DirName);
}
else
sprintf(FileName,"%s ",dwFlags.cFileName);
SendMessage (ServerFilesLST,LB_ADDSTRING, 0, (LPARAM)FileName);
}
okay this displays the files, but doesnt put them into any order. I tried to first store the dwFlags.cFileName temporaly and write a \n sequence after it, but when i tried this my program just destroyed itself...
this is what i tried.
sprintf(t_DirName,"%s \n ",dwFlags.cFileName);
strcat(DirName,t_DirName);
and then i sent the DirName to the list box after the while loop was finished. But as i said, the program just exited... anyway i am quite stuck on this little problem of mine, so any help would be greatly appreciated. Thanks again.