Hello. I'm confused about creating a file. I have found two possibilities:

1) FILE *inputFilePtr;
inputFilePtr = fopen("afile.txt", "rwb");

Where the "r" in the second argument to fopen() opens the file for reading, and the "b" specifies binary mode.

2) int file;
char *filename;
file = open(filename, O_WRONLY|O_CREAT);

I have been using the second one without problems, but I really want to know difference between boths.
I believe that both options create a binary file for reading and writing. Please correct if I'm wrong.

Thanks in advance.