Be specific. The difference between char and const char is that char is volatile while const char is non volatile.
Volatile variables CAN be changed and modified at any time. Non-volatile variables MUST stay the same every where! Forcefully changing them in some cases can cause corruption!
To change the const correctness of a variable you'd either use the C-style cast aka GodMode cast and should rarely ever be used.. OR you can use C++ style casting.
const char bleh;
char meh = (char) bleh; //casts away the constant part via c-style casting.
char meh = const_cast<char>(bleh); C++ style casting has 4 kinds. const, dynamic, static, reinterpret.
Anyway in the code above, I never used const char. I used const char *. There is a difference. char* is a pointer to an array of characters. We both know that an array of characters is equivalent in most cases to a string since strings are just a bunch of characters put togther.
const char* is an array of characters that will not change during runtime. You can pass values that are not const to a const char* without a cast. You can assign values to a variable from the const char* but modifying the pointer itself is a big no-no.
const char* Bleh = "Brandon";
std::string Meh = Bleh; //Assigning to a non const variable.
const char* Bleh = Meh.c_str(); //Meh is a string. C_str() is to convert it to a const string which can be assigned to a const char*.
All the of the above is fine. Const char* is just saying that this array of characters can be modified but the pointer to it cannot. Inorder to make sure that the array cannot modify, we do: char* const str = "Brandon"; This string can never ever be changed!
I could have easily used const std::string or std::string or std::string::c_str(); They'd all work the same.
Also for the FILE* pFile. That line declares a pointer to a File. A pointer to a file or any object where the size is unknown is known as either a handle or opaque pointer. An opaque pointer is something that you do not have a clue of it's size or what kind of data it points to.
FILE* pFile is a pointer to a file and it is opaque because I do not know the size of the pointer itself (completely different from file size). AND I do not know what kind of data the pointer points to. All I know is that it points to a file and that is it!
So first I declare a pointer/handle to a File then I assign it to an open file via fopen. If fopen fails, my pointer will be null. Null pointers are special because you can delete them without harm and you can close them without harm but they're useless because well? We want our file open thus it should not be null if it suceeded.
w = write only File is created if it does not exist.. If it does, the contents are erased and it's considered a new blank file.
r = read only. File must exist.
w+ = read and write at the same time. If the file does not exist, it will create it! if the file already exists, the contents are erased and it's treated as a blank new file.
r+ = open a file for reading and writing/updating. File must exist!
a = append to a file. File is created if it does not exist.
a+ = Open the file for reading and appending. All writing is done at the very end of the file. Hence appending. Creates the file if it doesn't exist already.
TLDR: File* pFile is a handle to a file. const char* is a string. Usually char* is a c-style string. At least in the context they are use in. Might sound harsh by saying be specific but the difference between char* and char can screw you over so I had to explain.