Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make a filename an array

Status
Not open for further replies.

nbgoku

Programmer
May 25, 2004
108
US
im trying to obtain a files name, and then make it into an array

CFileFind finder;
BOOL bWorking = finder.FindFile("C:\\*.mp3");
while (bWorking)
{
bWorking = finder.FindNextFile();
CString a = finder.GetFileName();
for(int n=0;n<=40;n++)
{
MessageBox(a[n]);
}

}


this doesnt work though, any ideas? also, notice that i said n<=40, but is there a way to get the size of a so i know what to say for n<= ?
 
the point of the file is the send a message representing each part (character,number,period,etc...) of the file name
 
You can use a CString as a character array - it obviously has the [] operator overloaded. I guess I don't understand what you are trying to accomplish. Are you trying to put all of the files into an array of CStrings? CString also has a GetLength() method that you could use in place of 40, though that's probably still not going to do what you are trying to get.
 
oh nice im gonna try the getlength()

what im trying to do is obtain the name of the first file, then spell out the first file letter by letter using MessageBox(), it seems wierd but im really interested in it at the moment
 
ah the problem has been solved, good deal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top