Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

how to trim the EE when receive packet from raw socket?

$
0
0

martinEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEBBEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

is there simple function to do this?

i am not sure whether it is caused from hex number or character

as after tried with the googled function, it do not show the received words

printf(trimwhitespace(replace_str(buff,"E","\0"))); // wrong, because it like removing everything

char *replace_str(char *str, char *orig, char *rep)
{
  static char buffer[4096];
  char *p;

  if(!(p = strstr(str, orig)))  // Is 'orig' even in 'str'?
    return str;

  strncpy(buffer, str, p-str); // Copy characters from 'str' start to 'orig' st$
  buffer[p-str] = '\0';

  sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));

  return buffer;
}

while(true)
{
	length = recvfrom(s, buffer, ETH_FRAME_LEN, 0, NULL, NULL);

	if (length == -1 && succeed == 0) {
		printf("recv error\n");
		succeed = 2;
	}
	if(length > 0)
	{
		char buff[46] = "\0";
		memcpy(&buff, &buffer[14], 46);
		printf(trimwhitespace(buff));
	}
}


成功者拿未來換現在,失敗者用現在換未來. 原來無求品自高, 機到有求先得手. She likes you and You can be a success. Keep it virtual. Type I or (Type I and Type II hypothesis error)


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>