Am new to C++, i just need a sample script for replaceing a string, that scripts accepts two arguments serach string(STR1) and Replace string(ST2)
then replace STR1 with STR2.
All programming languages are created for a purpose. Filename pattern search, directories traversing, simple maths etc are easily done using scripting languages.
Unless there is a compelling reason to use a compiled language, I tend to go for the scripting language approach. At least for regular expression crafting, I uses Perl extensively.
Above in C code. Note this is un-safe code. dest[1024] can get buffer over-run problem.
Anyone know how we can figure out the total length so I can make dest as char *dest = new char[<computed length>] instead of current char dest[1024] ?
Edit: ok fix the computed length.... hope I get my maths correct else Segmentation fault!!!! C programmers should really use scripting languages to do search and replace or at least go for C++ string or Java String classes :O