Memset a struct

Discussion in 'C Programming' started by BrainV, May 4, 2010.

  1. BrainV

    BrainV

    Joined:
    May 4, 2010
    Messages:
    2
    Hello

    I've got a struct in a class in the private field.


    Private:
    tyepdef struct mystruct
    {
    char date[10];
    char time[10];
    char name[20];
    } MYSTRUCT;

    MYSTRUCT MyStruct;


    Then I access it through some setter functions, for each element.

    I then have have a function that simply prints out each element of the struct to a file using fprintf. My issue is after I've printed the data, I want to be able to clear it, so I tried to use the memset function
    memset(MyStruct, '\0', sizeof(MyStruct));

    However when I compile I get the following error error C2664 'memset' : cannot convert parameter 1 from "class1::MYSTRUCT" to 'void*'



    Any idea how to fix this or to clear the struct?
     
    BrainV, May 4, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. k-man
    Replies:
    4
    Views:
    4,539
    Shelley Hebert
    Dec 18, 2003
  2. Joe C
    Replies:
    5
    Views:
    8,926
    tom_usenet
    Aug 24, 2004
  3. Nollie@runtime.com
    Replies:
    17
    Views:
    6,556
    Greg Comeau
    Sep 22, 2004
  4. Chris Fogelklou
    Replies:
    36
    Views:
    1,405
    Chris Fogelklou
    Apr 20, 2004
  5. Mark

    memset() on a struct or union

    Mark, Feb 2, 2010, in forum: C Programming
    Replies:
    21
    Views:
    10,773
    Richard Bos
    Feb 3, 2010
Loading...

Share This Page