Thursday, July 30, 2009

A C++ problem!! From a list of filenames from a textfile how can i choose only .jpg files??

Example:-





This is filelist.txt


{


a.exe


gonda.html


0809.jpg


honda.exe


0706.jpg


}





how can i extract only 0809.jpg and 0709.jpg and put it into another textfile........





Anotherfilelist.txt


{


0809.jpg


0709.jpg


}

A C++ problem!! From a list of filenames from a textfile how can i choose only .jpg files??
wat r u using to store thes filenames?





if simply strings then u have to check the characters after. and do your desired work
Reply:in your if statement trim the text to remain with the last 4 characters it could be .txt, .jpg, .exe then compare it with .jpg


pseudocode





if a=".jpg" then %26lt;place your action here%26gt;


a is varible with contains the strimed text





please vote as the best
Reply:fscanf("%s",a)


if the string a contains ".jpg" fprintf(a)


No comments:

Post a Comment