strcpy

hi,
here comes a simple question for all experts,
I have the following code:
1
2
char filename[30];
strcpy(filename, argv[1]);


now my filename is argv[1],
if my argv[1] is abczzzz.
BUT I ONLY WANT TO GET FILENAME abc and ignore the zzzz
how i gonna do it?
strncpy(filename,argv[1],3);
Last edited on
nope, its not working...
i have tried...
What does "it's not working" mean?
i get error from tat
error:
too many argument for strcpy
that's because you're calling strcpy and not strncpy as helios suggested
omg my mistake..
i get it ...
thx helios!
and Disch.
Topic archived. No new replies allowed.