The mount function

This is a discussion on The mount function within the Linux Programming forums, part of the Platform Specific Boards category; Hello, Can anyone help me with this? This is the code: ret = mount(DEVICE_FILE, MOUNT_DIR, "vfat", MS_MGC_VAL, NULL); I have ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    7

    Question The mount function

    Hello,

    Can anyone help me with this?

    This is the code:

    ret = mount(DEVICE_FILE, MOUNT_DIR, "vfat", MS_MGC_VAL, NULL);

    I have all of the values figured out except MS_MGC_VAL. It is an unsigned long int passed to the mount function and is used for a read/write flag.

    This is the error:

    hda: hda1
    hda: hda1
    [Error] Can not Open conftest
    [Error] Testing all
    Segmentation fault
    [root@Linux /root]$mount
    /dev/ram0 on / type ext2 (rw)
    /proc on /proc type proc (rw)
    none on /dev/pts type devpts (rw)
    /dev/hda1 on /flash type vfat (rw)
    [root@Linux /root]$

    As you can see the drive does get mounted in the code. I can read and write to it after the program has exited. The drive was not mounted before executing the program.

    I can't figure out what this value should be set at or if this is the problem.

    Thanks for any help,

    Matt

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Did you try reading errno? It is there for a reason.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Just take a look at the man page for said function...

    If the magic number is absent, then the last two arguments are not used

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

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