Thread: checking how many messages in msg queue using msgctl commands

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    23

    checking how many messages in msg queue using msgctl commands

    Hi,

    does anyone know how i can check how many messages are in the message queue, i tried IPC_STAT but it gives me a constant of 2.

    any help would be appreciated!!

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Code:
        struct msqid_ds ds;
    
        if (msgctl(msqid, IPC_STAT, &ds) == -1) 
        {
          perror ("msgctl");
        }
        else
        {
          printf ("There are %d msgs on the q\n", ds.msg_qnum);
        }
    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
    May 2004
    Posts
    23
    thanks mate

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 09:05 AM
  4. help with queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-21-2002, 09:09 PM
  5. help with queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-21-2002, 11:39 AM