"hard coding" means putting something into your source code. If you are not hard coding, then you do something like prompting the user for the data, or allow the user to put the data on the command line, or something like that.
So, to hard code the location of the file as being on the C: drive, you would just put the pathname of the file all together in your source code.
Here is an example.
int main()
{
const char *filename = "C:\myfile.txt";
printf("Filename is: %s
", filename);
}
The file name is "hard coded" as: C:myfile.txt
The reason the backslash is doubled is because backslashes are special in C strings.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…