I am downloading content from a web source using URLDownloadToFile winapi function
All is well, with that, the content is downloaded to the correct path.

My probems start when I try to read it, like below, the loop never exits.

myReadFile.open(sFile);

if (myReadFile.is_open()) 
        {
           while (!myReadFile.eof()) 
               {
                   //code;
               }
        }      
cout << "done" << endl; // is never displayed

It has been working before, the only thing which has changed is the content of the web source
and perhaps it's encoding.

Appreciate any advice on this matter.

The code you wrote is not reading the file.
Instead of MyReadFile.eof() do this, assuming MyReadFile is std::ifstream

std::string line;
while( getline(line, MyReadFile) )
{
   // blabla
}

Thanks Ancient Dragon.

I did have code there reading the file char by char, just was never reaching the end.

Seems it would not read it when there were either spaces, cr, lf and things like that.

I changed the websource in the end, I think it might have been something to do with unicode.

Cheers for advice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.