Recent Posts
None | 13 sec ago
C# | 1 min ago
Delphi | 1 min ago
Delphi | 1 min ago
Delphi | 1 min ago
Delphi | 2 min ago
C# | 2 min ago
PHP | 2 min ago
PHP | 2 min ago
Delphi | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Anonymous on the 9th of Feb 2010 10:20:16 PM
Download |
Raw |
Embed |
Report
char *InsertString(char *Data, char *InsertAfter, char *InsertData);
int main()
{
char *blah;
blah = InsertString("<html> </html>", "<html>", "<title>test</title>");
return 1;
}
char *InsertString(char *Data, char *InsertAfter, char *InsertData)
{
char *newData = (char*) malloc(strlen(Data) + strlen(InsertData) + strlen(InsertAfter) + 1);
int pos;
strcpy(newData, Data);
pos = strspn(Data, InsertAfter);
printf("%s - POS: %d\n", InsertAfter
, pos
);
memmove(newData+pos,InsertData, strlen(InsertAfter)+strlen(InsertData));
return newData;
}
/*
Result: <html><title>test</title>
Expected: <html><title>test</title></html>
*/
Submit a correction or amendment below.
[ previous version ] | [ difference ] | Make A New Post