I am trying to read data from a .pcap
file which is simultaneously being written to by USBPcap. I am doing it as mentioned in this answer, but my ifs.is_open()
call always fails.
Here is my code :
int main()
{
std::string fullFilename = "D:\\Ročníkový projekt\\USBCap\\sample2.pcap";
std::ifstream ifs(fullFilename.c_str(), std::fstream::binary | std::fstream::in);
long int i = 0;
if (ifs.is_open())
{
char c;
while (true)
{
while (ifs.get(c)) std::cout << c << "\n";
if (!ifs.eof()) break;
ifs.clear();
Sleep(500);
}
}
}
Any idea what is wrong?