Passing File Pointer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing File Pointer

    Is there anyway to pass a file pointer (fptr) a subroutine. I have tried a couple of different ways to do this. I would like to use a subroutine to output a measurement eachtime it is called instead of having to write a whole set of output states. I have come up with using an array to do similar, but the array is limited by the line length and can only contain about 18 measurement points.

    The other question would be is there some way to concatinate 2 arrays together? Thanks.

  • #2
    Man, that's kind of 'heavy' for a Saturday. Your best bet might be CRAIGERNY for an answer to this. He is the 'code master' (or one of them) on this board.
    sigpic
    Originally posted by AndersI
    I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

    Comment


    • #3
      You might be able to concatenate two arrays give it a try. I am thinking it will be multidimensional so you might want to querry it as a multidimensional array when you debug. What is the scoop on passing a pointer to a sub? I guess what I am asking is what is the sub you refer to? A PCDMIS sub, or a VB sub? I am assuming you ned to pass a path name. I am not sure if a sub can work from a pointer in another "routine" so to speak. You may need to pass the path name to the sub and have the sub create it's own reference to the file.
      <internet bumper sticker goes here>

      Comment


      • #4
        The poster may be using the term "file pointer" generically to mean a variable. ie. Can you access a variable's data in the sub if the data was put into the variable in the CMM Program. 'course I could be all wet....
        Links to my utilities for PCDMIS

        Comment


        • #5
          I ran into that same problem with line length. I ended up making arrays of about 10 measuring points and then add the arrays together. Worked for me.

          That line length limitation is painful. I wish they fixed that. Add some kind of character that lets the array go on into the next line or something...


          Jan.
          ***************************
          PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
          Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

          Comment


          • #6
            Yes a line continuation char would be nice. Until then 256 is the max column and that includes the wasted spaces and ID. You can not pass by ref to a VB sub. PCDMIS subs I don not know. I don't work with them. I am trying to picture what he is doing and by val should be good enough, I can't think of why he might need the sub to modify the original variable if it is just a path name.
            <internet bumper sticker goes here>

            Comment


            • #7
              What I am trying to do is setup a PCDmis subroutine which can output to a file the measurements. The program we have has about 30-40 points and each one the employees take 4 lines to make up the output(x.nom, x.dev,x.tloc,x.ploc,/n y.nom, x.dev, etc.) Then they take another 4 lines to write that to their file. I would like to either write a loop which goes through their array of measurements points or a subroutine which they could call for each measurement point. (e.g. outfile(measurement point,feature point,file pointer)). So instead of having 8 lines for each measurement point, they would have 1. The loop would work, but i can only fit 18 points in each. How do you add they arrays together is it Assign\newarray = old_array1 + old_array2?

              As far as I fould, you cannot use a string to declare a file name in PC-dmis. This is because the area which accepts the file name for the file pointer does it as standard text not " ". Is there some way to do that because I could pass the file name and have it open and close it each time? This seems like it would be repetative for the computer, but it makes it easier for the programmer.

              Comment


              • #8
                Pass the file name as a variable. ie V1 = pathname. Then pass V1.
                <internet bumper sticker goes here>

                Comment


                • #9
                  If you use a variable, you might find the path also has to have the forward slashes instead of backslashes...
                  Links to my utilities for PCDMIS

                  Comment


                  • #10
                    I think Mr Comment uses PCDMIS subs. Hopefully he'll ring in. I seem to remember issues he encountered with passing a variable as PCDMIS does not call it by ref or by val but I think he got straight on that one.
                    <internet bumper sticker goes here>

                    Comment

                    Related Topics

                    Collapse

                    Working...
                    X