I want to have the function fopen's filename parameter as a dynamic variable that takes in a ftp client input for my ftp server. I have tried numerous different ways both on this forum and on google but "filename" will still not be recognized by fopen.
else if (strncmp(client->input, "retr", 4) == 0) {
char fname[1024];
// COMMAND LINE: retr filePATHNAME thats why +5
strcpy(fname, client->input+5);
if(fopen(fname, "r") != NULL) {
...
If I put fopen("/pub/test.txt" , "r"), it works so it has to do with something with spaces or quotations or type.
But if i try to do it on the client command line with retr /pub/test.txt or even retr "/pub/test.txt" fopen does not work and will not open the file.
Been stuck on this for the longest time, any help is appreciated.
Thanks