rendered paste bodyvoid List() {
//format 002\r\n to a buffer
sprintf(sendbuf, "002\r\n");
//send it
send( ConnectSocket, sendbuf, strlen(sendbuf), 0 );
//receive directory listing.
recv( ConnectSocket, recvbuf, 4096, 0 );
cout << DEBUG << "command list sent";
//convert the buffer to an interger
sscanf(recvbuf, "%03d", &recvint);
//keep looping until we get "003"
while ( recvint != 3 ) {
cout << DEBUG << recvbuf << "\n";
recv( ConnectSocket, recvbuf, 4096, 0 );
sscanf(recvbuf, "%03d", &recvint);
}
printf("DEBUG: list finished");
}