This is my problem, I accidently deleted one of my files and now I forgot how to do one of the parts
FILE *name
name = fopen(argv[1], "r");
now i want to pass name into say function(char *file), how do i do this?
thanks
This is my problem, I accidently deleted one of my files and now I forgot how to do one of the parts
FILE *name
name = fopen(argv[1], "r");
now i want to pass name into say function(char *file), how do i do this?
thanks
Same as any other variable type
function(FILE *file);
Then
name = fopen(argv[1], "r");
function( name );
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
^ you can't do that, the function is not a FILE pointer
don't worry ppl, i found out how to...
i need to read line by line using fgets and pass them into the function
now i want to pass name into say function(char *file), how do i do this?
function(FILE *file);what do u mean fucntion is not FILE pointer. your question was how to pass a file pointer to the fucntion, and salem posted you the right.Originally Posted by vdk_au
ssharish2005
> you can't do that, the function is not a FILE pointer
Here's a tip - ask the question you meant to ask.
We can't help you if you just post random lines of code like bazarro and expect us to see deep into the crystal ball to figure out what your real question is.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.