|
-
October 21st, 2005, 08:54 AM
#1
return a FILE parameter
Probably it is a stupid question but I couldnt figure it out...
If I want to pass 2 FILE * parameters to a function_A, open it there and then use it in my main function...What I should do??
Look what I have tryed:
int main_function()
{
FILE *fp;
FILE *fp2;
CFile_Manip Cfile_manip;
Cfile_manip.function_A(fp, fp2); // fp is not returned !!??
fprintf(fp, "testing") // ERROR
}
bool CFile_Manip::function_A( FILE *fp, FILE *fp2)
{
char path[100];
char path2[100];
fp=fopen(path, "w");
fp=fopen(path, "w");
}
boh....someone would help me??
Thanks
-
October 21st, 2005, 09:06 AM
#2
Re: return a FILE parameter
Maybe like this?
Code:
int main_function()
{
FILE *fp;
FILE *fp2;
CFile_Manip Cfile_manip;
Cfile_manip.function_A(&fp, &fp2);
fprintf(fp, "testing") // ERROR
}
bool CFile_Manip::function_A( FILE **fp, FILE **fp2)
{
char path[100];
char path2[100];
*fp=fopen(path, "w");
*fp2=fopen(path2, "w");
}
- petter
-
October 21st, 2005, 09:46 AM
#3
Re: return a FILE parameter
yes!!! it works!!
thanks!!!
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
|