Thread: Char Buffer filtering

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    8

    Char Buffer filtering

    Hi,

    I am trying to filter the recieved buffer for a socket server app. below is the code segment.

    Code:
    while(*inBuffer != '\0') 
    	{
    	*buff++ = *inBuffer++;
    	}
    	*buff='\0';
    where as it returns an error

    d:\dotnet\wserver\wserver\netres.h(31) : error C2105: '++' needs l-value

    can anybody help please?

    Thank you,

    Thomas

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Is that code actually in netres.h ?

    Is it inside a macro? Because that's the only code you should have in a header file.

    How did you call that macro (assuming it is)?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Also, did you create a macro called buff or inBuffer?

  4. #4
    Registered User
    Join Date
    Jul 2010
    Posts
    8
    Quote Originally Posted by Salem View Post
    Is that code actually in netres.h ?

    Is it inside a macro? Because that's the only code you should have in a header file.

    How did you call that macro (assuming it is)?
    Correct. It was not supposed to be under header file. I moved it to the source with some changes and its fine. thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  3. Sorting Linked Lists
    By DKING89 in forum C Programming
    Replies: 6
    Last Post: 04-09-2008, 07:36 AM
  4. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 02:49 PM
  5. Strings are V important...
    By NANO in forum C++ Programming
    Replies: 15
    Last Post: 04-14-2002, 11:57 AM