Thread: fopen vs open

  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
    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, 03:24 PM
  2. What are differences between fopen() and open() ?
    By meili100 in forum C++ Programming
    Replies: 9
    Last Post: 04-08-2008, 10: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, 05:38 PM