I am using Borland C++Builder 5.0 on WindowsXP.
I have a directory structure that includes separate directories for different files:
\exe - executables
\src - source files
\tinyxml - tinyxml files
\trial - any *.xml files
I declare a Sting and enter the file name incluing the path for the "xml" file then pass it to LoadFile() as shown below.
The tinyxml.cpp function "LoadFile( const char* filename, TiXmlEncoding encoding )" fails to open the file (line 1017) appearing not to recognise the filename with the associated path. If I open an "xml" file located in the "\exe" directory everything works ok.
Can you offer me a solution that allows me to use separate directory locations?
Regards Tony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I guess you have an error in the path you use. Are you sure you double the backslashes ("..\\trial\\tr1.xml") in your case?
I am often using full path to files, and never had any problem with TinyXML in that area.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your quick reply and yes the double backslashes ("...\\trial\\myfile.xml") are in place. I also recompiled my program after setting one of the first lines of tinyxml.h to "#define TINYXML_USE_STL". Are there any other options that need to be set? Are there any Borland specific issues?
Regards Tony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I guess it could be that the Working Directory is not set, and it might not default to the \exe dir.
I've had a similar problem in VS6 and setting the Working Directory for the executable to the same dir as the executable solved it for me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using Borland C++Builder 5.0 on WindowsXP.
I have a directory structure that includes separate directories for different files:
\exe - executables
\src - source files
\tinyxml - tinyxml files
\trial - any *.xml files
I declare a Sting and enter the file name incluing the path for the "xml" file then pass it to LoadFile() as shown below.
void TXMLEquipmentDocument::Open(String TheDocument)
{
const char *FileName;
FileName = TheDocument.c_str();
TiXmlDocument doc(FileName);
LoadOK = doc.LoadFile();
if (LoadOK)
{
..................
}
else
{
...................
}
}
The tinyxml.cpp function "LoadFile( const char* filename, TiXmlEncoding encoding )" fails to open the file (line 1017) appearing not to recognise the filename with the associated path. If I open an "xml" file located in the "\exe" directory everything works ok.
Can you offer me a solution that allows me to use separate directory locations?
Regards Tony
I guess you have an error in the path you use. Are you sure you double the backslashes ("..\\trial\\tr1.xml") in your case?
I am often using full path to files, and never had any problem with TinyXML in that area.
Yves
Thanks for your quick reply and yes the double backslashes ("...\\trial\\myfile.xml") are in place. I also recompiled my program after setting one of the first lines of tinyxml.h to "#define TINYXML_USE_STL". Are there any other options that need to be set? Are there any Borland specific issues?
Regards Tony
Have you debug your program to see what is the value of FileName?
I have never had problems and load xml files from different locations also.
I guess it could be that the Working Directory is not set, and it might not default to the \exe dir.
I've had a similar problem in VS6 and setting the Working Directory for the executable to the same dir as the executable solved it for me.