-
March 22nd, 2010, 07:18 PM
#1
Passing String to a Function
I know the following will look weird but I am simply not able to understand how string passing works.
#include<iostream>
#include<ctype.h>
#include<fstream>
using namespace std;
void myfilemaker(char *fn);
int main(void){
char fn[20];
cin>>fn;
myfilemaker(&fn[0]);
system("pause");
}
void myfilemaker(char &fn[0]){
ofstream.myfile;
myfile.open(fn[]);
myfile<<"Something";
myfile.close;
return;
}
Please tell me how to pass the string. I have tried tweaking the fn variable a bit but nothing seems to work.
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
|