C/C++ Common Function

1.Copy a String to another String
char strOne[1024];
strcpy(strOne,argv[1]);//Copy parameter at index 1 to string strOne

2.Split a String with a Delimiter and take the first part
char strOne[1024];
strOne= strtok(“test.txt”, “.”);//The strOne will be “test”

3.Concat Two String
char strOne[1024];
strOne = strcat(“test”, “.bak”);//The strOne will be “test.bak”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.