CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Mar 2012
    Posts
    2

    Question FreeFile(1) - what does Open 256+ really do?

    The definition of file number in the Open file syntax states that a FileNumber of 256 through 511 is to be used for files accessible from other applications.

    Does anybody know what this really means? What is the difference between opening a random file ... As 1 vs ... As 256?

    Thanks!

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: FreeFile(1) - what does Open 256+ really do?

    Where did you get that from?

    FreeFile does not take a parameter. It returns the first available file number or an error if more than 255 file handles are currently in use.
    http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx


    I would expect open for input as #257 to crash with an error
    Last edited by DataMiser; March 2nd, 2012 at 10:23 PM.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: FreeFile(1) - what does Open 256+ really do?

    Pretty sure 8-bit file handles were still in use. 0-255
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: FreeFile(1) - what does Open 256+ really do?

    I remember back in the days when it was not uncommon to only be able to have 3 or 4 open files at a time. Can't remember the exact syntax but there was a line in the cfg file to set max files and was almost always set to a number < 10
    Always use [code][/code] tags when posting code.

  5. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: FreeFile(1) - what does Open 256+ really do?

    Ah... the olden days. Config.Sys, files=20, buffers=40...

  6. #6
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: FreeFile(1) - what does Open 256+ really do?

    I knew it had something to do with sys and cfg but I could not remember the name. Thankfully it has been a long time since I needed to edit one of these files. Now I have almost forgotten everything about it.
    Always use [code][/code] tags when posting code.

  7. #7
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: FreeFile(1) - what does Open 256+ really do?

    Really? Are younger programmers that forgetful?
    I must admit that I can remember the commands of my old CP/M system better than the .NET stuf I looked at last week.
    I put that to WoF.System.Memory.Learning.Programming.NETstuff.Important.Recall again.

  8. #8
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: FreeFile(1) - what does Open 256+ really do?

    Its sad just how much my memory has went downhill in recent years. Used to be someone could talk with me for 10 minutes about a project and I would still remember the details 2 years later and now 10 minutes after the conversation I may not even remember having the conversation

    I think I need to purcahse a new stick or 2
    Always use [code][/code] tags when posting code.

  9. #9
    Join Date
    Mar 2012
    Posts
    2

    Re: FreeFile(1) - what does Open 256+ really do?

    While I do still remember the old open file limitations this does not have anything to do with that (besides the file numbers were limited to 1 to 255 back then).

    This is in VB6. The help screen for the "Open" statement lists the filenumber parameter and then the link on filenumber shows: "Use file numbers in the range 1-255, inclusive, for files not accessible to other applications. Use file numbers in the range 256-511 for files accessible from other applications."

    And the FreeFile function accept an optional parameter: 0 = returns 1 - 255, 1 = returns 256-511. (the optional parameter defaults to 0 so it returns 1-255 as it always did).

    Somebody at Microsoft obviously did this for a reason but I cannot find any additional information on it and in testing files opened with high vs. low file number and I cannot see the difference.

  10. #10
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: FreeFile(1) - what does Open 256+ really do?

    After some searching I found the info in the Op but nothing to expand on it so I have no idea what a filenumber above 255 would do in VB6. It appears these filenumbers are not supported in later versions of VB and I was not aware they could be used in VB6 until now.

    The only thing that makes sense from the little info that is provided would be if you are opening a file to allow shared access but I was under the impression that the shared option was the method which should be used for this so again I do not know.

    My take would be to stick with normal filenumbers 1-255
    Always use [code][/code] tags when posting code.

  11. #11
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: FreeFile(1) - what does Open 256+ really do?

    I must admit, I never heared about that optional parameter on FreeFile at all.
    How do you share a file with another application anyway? One is reading it, the other is writing to it?

  12. #12
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: FreeFile(1) - what does Open 256+ really do?

    Quote Originally Posted by DataMiser View Post
    After some searching I found the info in the Op but nothing to expand on it so I have no idea what a filenumber above 255 would do in VB6.
    Could you post that link... I cant seem to find anything official..
    only this obscure post where he says that Freefile(1) allows you to access the next 255 file numbers...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  13. #13
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: FreeFile(1) - what does Open 256+ really do?

    It is actually in the msdn help that came with VB6 under the Open Statement.
    Here is a link related to VBA which says pretty much the same thing.
    http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx
    Always use [code][/code] tags when posting code.

  14. #14
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: FreeFile(1) - what does Open 256+ really do?

    This says File# (Channel #) can be 1-255 http://www.informit.com/library/cont...urs&seqNum=159
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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
  •  





Click Here to Expand Forum to Full Width

Featured