Thread: Help!

  1. #1
    Registered User subdene's Avatar
    Join Date
    Jan 2002

    Unhappy Help!

    Does anyone know how to write a function which can have any stream handle passed to it?

    For example.

    const char Handle[]="outfile"


  2. #2
    Registered User Invincible's Avatar
    Join Date
    Feb 2002
    What do you mean by "stream handle"? It looks like you're trying to pass a character array in that example.

    If that's what you're asking then:

    const char array[25] = {"outfile"} //needs decriptor brackets
    const char file[25] = {"Out.txt"} //better not to pass strings
    //so we will pass "Out.txt"  as a variable as well
    createfile(array, file);
    //there you have 2 char strings being passed
    //and your function definition would look like this
    //with brackets in the definition to recieve the arrays
    void  createfile(char array[], char file[])
         do stuff; 
    Hope this helps
    "The mind, like a parachute, only functions when open."

Popular pages Recent additions subscribe to a feed