fopen vs open

This is a discussion on fopen vs open within the Linux Programming forums, part of the Platform Specific Boards category; i did have a search for this. i understand open is a low-level version of fopen and allows greater control ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    351

    fopen vs open

    i did have a search for this.

    i understand open is a low-level version of fopen and allows greater control over devices. file permissions can also be set on the same line.

    what are the pros of using fopen over open? i need to be able to set permissions. what is the best way of doing this with fopen?

    some stuff on the web discussed the problems of using many fopens at once. also that using open may cause performance problems.

    TIA, rotis23.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>i need to be able to set permissions. what is the best way of doing this with fopen?
    You can't, I don't believe.

    Is this *nix specific, if so, I'll move it to the other board.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    yeah, i'm using open at the moment. i just wasn't sure of the practical differences.

    i think this is relevent to both. maybe more useful in the linux prog board.

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    ok, thanks for the correction.

    i wasn't aware that open was posix specific. my question has been answered.

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    385
    fopen() doesn't deal with permissions, you need to use the chmod() system call for that if you're under Linux.
    Wandering aimlessly through C.....

    http://dbrink.phpwebhosting.com

  6. #6
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    for those who may be interested and not know, open() also allows lower-level file control under ms-dawz, but i'd imagine in different ways than a posix version.
    hello, internet!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fopen can't open .exe?
    By fanoliv in forum C Programming
    Replies: 11
    Last Post: 04-05-2011, 04:24 PM
  2. What are differences between fopen() and open() ?
    By meili100 in forum C++ Programming
    Replies: 9
    Last Post: 04-08-2008, 11:14 AM
  3. open, fopen ?
    By Matrim in forum C Programming
    Replies: 2
    Last Post: 02-01-2005, 09:45 AM
  4. fopen() and open()
    By Encrypted in forum C Programming
    Replies: 8
    Last Post: 02-09-2003, 04:57 PM
  5. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 06:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21