I'm trying to send a list of songnames to a client i built. Everything compiles fine, it even sends the first filename right. When the server begins to send the second filename it sends every filename as one. E.g:
First: Like the way.mp3
Second: Pump it up.mp3Billionaire.mp3...... it just continues like this.
I also print every filename with "cout", and there's everything fine.
CFileFind finder;
CString myDirectory = "E:\\Users\\****\\Music\\Musiklk\\";
BOOL finding = finder.FindFile (myDirectory + CString ("\\*.mp3"));
while (finding)
{
finding = finder.FindNextFile();
CString fname = finder.GetFileName();
char songname[200] = "";
strncpy((char *) songname, (LPCTSTR) fname, sizeof(songname));
send(client,songname,strlen(songname),0);
cout << songname << endl;
}
finder.Close ();
BTW: I'm still learning C++....