| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | C |
RM> myfunc( char *s)
RM> {
RM> int i;
RM> char *p;
RM> i = strlen(s);
RM> p = malloc(i+1);
RM> ^^^ allow space for null terminator
RM> strcpy(p,s);
Does it? I thought it copied from p[0], and left the spare one on
the end at p[i]. Bloody hell.
Regards,
Bob
___ Blue Wave/QWK v2.12
@EOT:
---
* Origin: Precision Nonsense, Sydney (3:711/934.12)SEEN-BY: 711/934 @PATH: 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.