|
-
March 23rd, 2010, 10:29 AM
#4
Re: Passing String to a Function
 Originally Posted by gameman144
your myfilemaker() function should read:
Code:
void myfilemaker(char* fn)
{
ofstream myfile(fn);
myfile<<"Something";
myfile.close();
}
Note that since myfile is about to go out of scope anyway, the .close() call is redundant and unnecessary. The file will be closed when the ofstream's destructor is called.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|