I've got a C++ side-job. It's not MFC or .NET, just straight C++ (really almost just C), and I can't remember some really basic stuff that I know I learned in my second semester of C++. Please to help!
Let's say that, instead of using CStrings (or any string data type), we are using char arrays for string storage:
(Oh, and we are using the <stdio.h> library for i/o)
and let's also postulate (2-point word!) that we've written a function to take this file name as an argument, but that argument must take the following (pointer) form:
I cannot, for the life of me, remember how to pass the char array ('myFile[9]') into that function, so that the function has a handle on the file.
Anyone in the mood to point out the incredibly obvious?
"I would rather have a free bottle in front of me, than a pre-frontal lobotomy..."
-Shrubble
Let's say that, instead of using CStrings (or any string data type), we are using char arrays for string storage:
Code:
char myFile[9] = "hello.txt";
(Oh, and we are using the <stdio.h> library for i/o)
and let's also postulate (2-point word!) that we've written a function to take this file name as an argument, but that argument must take the following (pointer) form:
Code:
bool fileExists(char *infile)
{
//... body of function
}
I cannot, for the life of me, remember how to pass the char array ('myFile[9]') into that function, so that the function has a handle on the file.
Anyone in the mood to point out the incredibly obvious?
"I would rather have a free bottle in front of me, than a pre-frontal lobotomy..."
-Shrubble