I'm trying to write a TCP server which a client can use to browse the server's directories. In addition to that I want to send the size of the directory if that is a regular file. The size of the file is saved into a size_t variable under a "stat" struct. I'm doing this here:
char *fullName /* The path to the file *.
/**
* Some code here
*/
struct stat buffer;
lstat(fullName, &buffer)
So now buffer.st_size contains the file's size. Now I want to write() it to the listening socket but apparently I have to convert it to a string somehow. I know this can be done somehow with the bitwise right-shift (>>) operator but it seems too painful to me. Can you help me out here (even if there's no way other that bitwise operators)?
By the way this is not for school or smth...
PS: I'm running this on Linux.