W
Witek76
Guest
In VS 6 I use that code:
and everythink is OK.
In VS 2005 the same code does not work. I changed it.
but does not hit the correct data to the variable strLinia1
Thx for all help.
PS I don't want to turn on: Use Multi-Byte Character Set in project setting.
Continue reading...
C++:
CInternetSession InternetSession;
CStdioFile *pHttpFile;
CFile File;
try {
m_sAktualizacja = "";
pHttpFile = InternetSession.OpenURL("http://site.pl/data.xml");
if (File.Open(pathTempDirectory+"\\data.xml", CFile::modeWrite | CFile::modeCreate))
{
char pBuffer[200];
while (pHttpFile->ReadString(pBuffer, 199) != NULL)
{
CString strLinia1(pBuffer);}
}
pHttpFile->Close();
}
catch(CInternetException *e)
{
e->Delete();
}
CInternetSession InternetSession;
CStdioFile *pHttpFile;
CFile File;
try {
m_sAktualizacja = "";
pHttpFile = InternetSession.OpenURL("http://site.pl/data.xml");
if (File.Open(pathTempDirectory+"\\data.xml", CFile::modeWrite | CFile::modeCreate))
{
char pBuffer[200];
while (pHttpFile->ReadString(pBuffer, 199) != NULL)
{
CString strLinia1(pBuffer);}
}
pHttpFile->Close();
}
catch(CInternetException *e)
{
e->Delete();
}
and everythink is OK.
In VS 2005 the same code does not work. I changed it.
C++:
CInternetSession InternetSession;
CStdioFile *pHttpFile;
CFile File;
try {
m_sAktualizacja = "";
// Konwersja CString na LPTSTR
CString theString("http://site.pl/data.xml");
int sizeOfString = (theString.GetLength() + 1);
LPTSTR url = new TCHAR[sizeOfString];
_tcscpy_s(url, sizeOfString, theString);
// Koniec
pHttpFile = InternetSession.OpenURL(url);
pathTempDirectory += "\\data.xml";
CString pathTemp (pathTempDirectory);
sizeOfString = (pathTempDirectory.GetLength() + 1);
LPTSTR path = new TCHAR[sizeOfString];
_tcscpy_s(path, sizeOfString, pathTemp);
if (File.Open(path, CFile::modeWrite | CFile::modeCreate))
{
TCHAR pBuffer[200];
while (pHttpFile->ReadString(pBuffer, 200) != NULL)
{
CStringA strLinia1(pBuffer); }
}
pHttpFile->Close();
}
catch(CInternetException *e)
{
e->Delete();
}
CInternetSession InternetSession;
CStdioFile *pHttpFile;
CFile File;
try {
m_sAktualizacja = "";
// Konwersja CString na LPTSTR
CString theString("http://site.pl/data.xml");
int sizeOfString = (theString.GetLength() + 1);
LPTSTR url = new TCHAR[sizeOfString];
_tcscpy_s(url, sizeOfString, theString);
// Koniec
pHttpFile = InternetSession.OpenURL(url);
pathTempDirectory += "\\data.xml";
CString pathTemp (pathTempDirectory);
sizeOfString = (pathTempDirectory.GetLength() + 1);
LPTSTR path = new TCHAR[sizeOfString];
_tcscpy_s(path, sizeOfString, pathTemp);
if (File.Open(path, CFile::modeWrite | CFile::modeCreate))
{
TCHAR pBuffer[200];
while (pHttpFile->ReadString(pBuffer, 200) != NULL)
{
CStringA strLinia1(pBuffer); }
}
pHttpFile->Close();
}
catch(CInternetException *e)
{
e->Delete();
}
but does not hit the correct data to the variable strLinia1
Thx for all help.
PS I don't want to turn on: Use Multi-Byte Character Set in project setting.
Continue reading...