C....Fun with strings :(
Im writing a C program, right now I have a loop that lists files in a dir, one by one. With each file being listed, I'd like to concatenate the html code:
<img src="/icons/file.gif" alt="FILE" /> <a href=" ********Before the file name and "></a> ********after the file name. So file string start is: readme.txt then after is: <img src="/icons/file.gif" alt="FILE" /> <a href="readme.txt"></a> I've tried strcat() among other things and can get ending portion concatenated to filename, but cant get <img src="/icons/file.gif" alt="FILE" /> <a href=" concatenated to beginning of filename. im also having trouble becase there are " in the string I need to work with. Any Suggestions?? Thanks!! |
prefix the " with a \
|
Thanks,
That takes care of one problem. Also...Would anyone have an idea where to start or have a code example of how I could append / concatenate the 2 pieces of html code to a string /file name? |
Try this:
sprintf(buffer, "<img src=\"/icons/file.gif\" alt=\"FILE\" /> <a href=\"%s\""></a>", filename); |
All times are GMT -5. The time now is 02:54 PM. |