www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/19/16:25:26

Date: Mon, 19 Sep 1994 14:12:38 +0500
From: ronis AT onsager DOT chem DOT mcgill DOT ca (David Ronis)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Bug(?) in memccpy()?

I want to use memccpy to left-shift a part of a string, but it doesn't seem to work.
I'm using 1.11m5.  The following code gives an example of the problem:

#include <stdio.h>
#include <string.h>

main(int argc,char **argv)
{
	char *p, buf[BUFSIZ];
	int i=atoi(argv[1]);

	strcpy(buf,argv[0]);
	p=memccpy(buf,buf+i,'\0',BUFSIZ-i);
	printf("(%d,%d, %X, %X):  %s->%s\n",BUFSIZ,i,p,p-buf,argv[0],buf);
	exit(1);
}


Thanks


David Ronis

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019