Compiler error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Thekid
    New Member
    • Feb 2007
    • 145

    Compiler error

    I'm trying to compile some C++ code and I'm getting one error that says:
    Empty Character Constant. I know that's ' ' without anything in it but how do I correct this? I get many other errors when I remove it or add something in it.
    the line looks something like this:
    memset(XXX_addr .sin_zero, ' ', sizeof XXX_addr.sin_ze ro);

    Any suggestions?
  • ilikepython
    Recognized Expert Contributor
    • Feb 2007
    • 844

    #2
    Originally posted by Thekid
    I'm trying to compile some C++ code and I'm getting one error that says:
    Empty Character Constant. I know that's ' ' without anything in it but how do I correct this? I get many other errors when I remove it or add something in it.
    the line looks something like this:
    memset(XXX_addr .sin_zero, ' ', sizeof XXX_addr.sin_ze ro);

    Any suggestions?
    Can you please calrify what you are trying to do? If you are trying to create a string of 10 spaces just put a space in the quotes.

    Comment

    • gpraghuram
      Recognized Expert Top Contributor
      • Mar 2007
      • 1275

      #3
      Originally posted by ilikepython
      Can you please calrify what you are trying to do? If you are trying to create a string of 10 spaces just put a space in the quotes.

      As suggested by ilikepython.... try to use memset with 0 or space like
      memset(obj,0,si zeof(obj);
      or
      memset(obj,' ',sizeof(obj);


      Raghuram

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Do you have a space between your single quotes??

        An empty character constant is a pair of single quotes with nothing between them.

        Comment

        Working...