I am trying to find a string in the given file (actually the file is tar file(please pay attention here) and i opened the file in notepad++ and took randomly a string from that opened file) and i stored that full tar file in a buffer and now i want to find the position of the string i copied using strstr function in the stored buffer.
The code to do is this(which is absolutely correct)-
char *compare= "_.png"; //suppose this is the copied string
//which is to be find out in buffer using strstr
char * StartPosition;
StartPosition = strstr (buffer,compare);
__int64 count=0;
MessageBox(m_hwndPreview,L"before the while loop",L"BTN WND6",MB_ICONINFORMATION);
while (StartPosition!=NULL)
{
MessageBox(m_hwndPreview,L"hurr inside the while loop",L"BTN WND6",MB_ICONINFORMATION);
MessageBoxA(m_hwndPreview,strerror(errno),"BTN WND4", MB_ICONINFORMATION);
count=StartPosition-buffer+1;
return 0;
}
and suppose if i have content of tar file in notepad like as below from where i copied this string stored in compare-
3_VehicleWithKinematicsAndAerodynamics_.000.png IHDR (here is some strange data which can't be copied and also there are lot of NULL but we have to find out the position of "_.png" so not so difficult in this case ).
The question is my code works fine until i store the data before the .png then i am able to find its position using strstr the problem is when i try to find out the string postion which is appearing after
`3_VehicleWithKinematicsAndAerodynamics_.000.png IHDR ...suppose here we have strange data (which is data block if we see the tar parser)...after this we have another file like..."3_VehicleWithKinematicsAndAerodynamics_.html"`
and if i want to find this "3_VehicleWithKinematicsAndAerodynamics_.html" using strstr then i am not able to find it due to strange data in between them.(because i think that those data are not recognized by the compiler and dut to that i am not able to access the file which is located after the strange data)
to make more clear see the location of file in tar file is as follows-
3_VehicleWithKinematicsAndAerodynamics_.000.png IHDR ............(its data blocl-which is strange contents if you open in tar file)....3_VehicleWithKinematicsAndAerodynamics_.000.html
i have to access the .html file using strstr . why it is not accessing it ?? any ideas ?? *
PLEASE GIVE THE ALTERNATIVES TO ACHIEVE IT..I am sure what i try won't work..