Results 1 to 4 of 4

Thread: How to lock read/write using fstream (or ifstream)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416

    How to lock read/write using fstream (or ifstream)

    Ok, when using "#include <fstream.h>" using file_buf::sh_read or any of the sh_*'s work just fine. But when using "#include <fstream>", they don't work. Even when im "using std::filebuf" ... Says sh_*'s are not part of filebuf namespace or whatever.... So how do you get them to work, or is there some other way you're meant to lock files with <fstream> ?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You can't specify a lock mode with the new headers. Apparently it was thought useless or maybe non-portable, I don't know. It's no longer part of the ANSI standard (or maybe it never was, only an extension of M$).
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    That sucks Guess I'm stuck using old headers when I need locking capabilities

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I think the new always lock the files completly. What do you need the capabilites for?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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