opening a file gives not expexted return value : could someone please explain me, why file opening is not successful? why printing "file" will give -1? Is it a problem with char *source ?


        
        int opf(char *source){
        int file;
        file=open(source,O_RWR);
        printf("%d",file); 
    }

And is it possible to do something like this:
file is in another directory, so

    int opf(char *source){
        int file;
        file=open("some_directory/ %s",source,O_RWR);
        printf("%d",file); 
    }
here I get the "makes integer from pointer without a cast" error. I tried many different things but i guess the problem lies with me not grasping  correctly the concept of pointers.
I am making some basic mistakes here . So, sorry if I do offend someone with this bad coding.

with best regards