|
What he means is:
Find lines: 241, 242, 254 and 504
change the "{"",' ',SectionName,"",""}" To:
Record s;
s.Comments = "";
s.Commented = '\0'; //This prevents empty character constant error.
s.Section = SectionName;
s.Key = "";
s.Value = "";
Do the same for the other lines and it should work.
Douglas Saltsman
www.primopdf.com <-- Download my free PDF creator
|
|
|
|
|
I had the same compilation erros, but I have fixed them in another way. Instead of assigning each single attribute, I have created constructors for the struct CIniFile::Record (remember that in C++ "struct" constructions are just like "class" constructions, except by the fact that the former has "public" as default visibility).
The code changes in CIniFile::Record are shown below:
struct Record
{
string Comments;
char Commented;
string Section;
string Key;
string Value;
Record() { Commented = ' '; }
Record(const string& commentsStr, char commented, const string& sectionStr,
const string& keyStr, const string& valueStr)
: Comments(commentsStr), Commented(commented), Section(sectionStr), Key(keyStr), Value(valueStr)
{ }
};
Now, all you have to do is change faulty lines like that:
Record r = {"",' ',SectionName,KeyName,Value};
to the proper use of the new constructor:
Record r ("",' ',SectionName,KeyName,Value);
I hope someone will find it useful...
|
|
|
|
|
after this fix:
--------------------Configuration: Object - Win32 Final--------------------<br />
Compiling...<br />
IniFile.cpp<br />
C:\proj\AVP2\ObjectDLL\IniFile.cpp(132) : warning C4018: '!=' : signed/unsigned mismatch<br />
\lithshared\stl\stl/_algo.c(88) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(88) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(88) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(88) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingSectionSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(88) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(88) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::DescendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(88) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(88) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(89) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(91) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(95) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2664: '()' : cannot convert parameter 1 from 'const struct CIniFile::Record' to 'struct CIniFile::Record &'<br />
Conversion loses qualifiers<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
\lithshared\stl\stl/_algo.c(97) : error C2064: term does not evaluate to a function<br />
\lithshared\stl\stl/_algo.c(1152) : see reference to function template instantiation 'const struct CIniFile::Record &__cdecl _STL::__median(const struct CIniFile::Record &,const struct CIniFile::Record &,const struct CIniFile::Record &,struc<br />
t CIniFile::AscendingRecordSort)' being compiled<br />
Error executing cl.exe.<br />
<br />
Object.lto - 40 error(s), 1 warning(s)<br />
The following environment variables were not found<br />
$(LT2_DIR)<br />
$(AVP2_BUILD_DIR)
|
|
|
|
|
Hello!
I have some comments to your code, I think it is very expensive to use:
Why are all functions static?
Most of the time I want to load/save the INI File once or only very seldom, at startup or when the user changes the preferences. So, simply make it a normal class, make filename and the content vector a member and thats it.
When I want for some reasons to reload/save the data, I can do it with the Load/Save memberfunctions. But there is no need to enforce that it is done automatically.
Some lesser improvements:
1) Please do not add the line:
using namespace std;
to your header file!
With it you defeat the whole idea behind putting something in a namespace. Everywhere youre header is included, the whole namespace gets included.
2)
Also, in the header you do not need to include e.g. iostream because you only need it in the cpp file. While this is more of an optimization please try to minimize the headers you include in headers.
Everybody who uses a compiler with no precompiled header feature will be grateful.
3) Use const&:
e.g.
static bool AddSection(string SectionName, string FileName);
should get its parameters by const& because there is no need that the strings are copied
4) Errorchecking on streams.
You do no errorchecking if a read access to the inifile fails. While an eror is unlikely you still should protect against it.
Maybe use:
while(!std::getline(inFile, s)))
{ ... }
if (inFile.eof()) return true;
else return false;
This way you could also remove the test for is_open.
5) Do not use endl. For better performance use '\n'. Use endl only if you really intend to flush the stream. You only want this seldom with files.
cu
|
|
|
|
|
|
Hmmm... hadn't thought about it, but sure - that could be helpful, especially if all you use are integer values. It would at least save you the trouble of converting to/from a string.
Sure, I'll add it to the next "version", whatever that is
Thanks for the suggestion.
-Todd Davis (toddhd@gmail.com)
|
|
|
|
|
|
|
This is because the precompiled header and object files are in the zip file. This will probably get cleaned up by the Code Project team.
Apart from that the code is very clean.
Yves Tkaczyk
|
|
|
|
|
Please fix the file. Many people cannot (or will not, or do not want to) download .pch .
|
|
|
|
|
Sorry about that guys - I just zipped up the whole VS project - I'm spoiled by highspeed internet
I rezipped it up with just the source files, and the (Windows only) executable. Now its only 68k. Does that help?
-Todd Davis (toddhd@hotmail.com)
|
|
|
|
|
Thanks! Great and useful class, will keep my eye on its development!
|
|
|
|
|
hi todd,
this may be a pointless question because of the cross-platform nature of the code but would there be any value to being able to import from/export to the windows registry.
i've writen a freeware app that allows users to store settings either in the registry or a .ini file but at present does not provide the ability to switch later on.
i'm not asking you to do the work for me but am just interested in your response.
rgds
.dan.g.
AbstractSpoon Software
|
|
|
|
|
I think there is a ton of value in it actually - what I'm not sure is if I would try to handle that in this class. A friend of mine on GameDev.net pointed out the way he handles it - he creates a Config class that handles configuration settings in a generic way - then subclasses are called which pull the data from the ini file/xml/registry/whatever so that future changes can be made invisibly. Here is some pseudo-code to explain further:
class IConfig
{
public:
...
virtual bool ReadSetting(const TCHAR * Setting, std::string & Value) = 0;
virtual bool ReadInt(const TCHAR * Setting, int & Value)
{
std::string StrValue;
if(ReadSetting(Setting, StrValue))
...
return false;
}
virtual void WriteSetting(const TCHAR * Setting, const TCHAR * Value) = 0;
...
};
class CIniConfig : public IConfig
{
// use .ini files
};
class CXmlConfig : public IConfig
{
// use .xml files
};
class CRegistryConfig : public IConfig
{
// use windows registry
};
-Todd Davis (toddhd@hotmail.com)
|
|
|
|
|
You mean your VB program can be run on UNIX, LINUS, Apple OS..... and Window(s)?
Woww, you are so great. Perhaps you are the FIRST person who can run vb app on Unix/Linus/Apple OS.....
YOU ARE THE MAN!!!!
by the way, I do not see any reason should use .ini in .Net environment.
Perhaps, config file is much better than .ini
Log4net shows me a great example of using config file.....
|
|
|
|
|
Thanks for those really productive comments A@damn. Let me clear a few things up for you.
First, this is not a VB progam.
Second, this is also not a .NET program.
I thought that the title of this article, "CIniFile Class for C++ - A robust cross platform Ini file class" would have made those points clear, perhaps I'll need to be more careful in the future.
By the way, my VB.NET programs *can* run on Unix, Linux and Apple OS (which most people refer to as the Mac OS, but you are much smarter than I). And no, I am not the first person to accomplish this. It was accomplished by lots of hard working, open source folks, and you can learn more about it by visiting the Mono project:
http://www.mono-project.com/about/index.html
I do agree with you about two things however - I am great, and I am the man.
Finally, my *other* article is a VB.NET Ini file - as other this writing, it has 15,677 views, an excellent rating, and I have had so many people email me about it that I had to get an alternate email address to forward the emails to. It is unfortunate that you can't see why an ini file would be useful in a .NET environment, but fortunately, not everyone is as short-sighted as you. Bottom line, you use what works, is easily deployable and supportable, and leaves the door open for cross platform and cross application data management. The venerable ini file can't be beat, even by XML, in straight forward readability.
Thanks for making my day
-Todd Davis (toddhd@hotmail.com)
|
|
|
|
|
I forgot that *we" have mono....
Did I say: you are the MAN!!? Did I?
|
|
|
|
|
Todd
You asked in your artcle for suggestions as to how to do all the key comparisons in one case (upper or lower) so that they are not case sensitive yet preserve the case when saving the file.
I'm a bit of an amateur (so please forgive what may be a very lame idea) but my approach would be to have a struct (or class) in which the keys are duplicated, one containing the original mixed case strings (used for writing back to the file) and the other converted to upper case for the comparisons. It makes the class a little bigger and adds a little overhead but it might be worth it.
Sincerely
Simon Rodan
|
|
|
|
|
Hello Todd,
I've looked at the code and it really is what I'm looking for, but this does not compile on linux systems. It is not as cross-platform as it could be. Can you give me some advice?
The problem area is 'tchar.h'. This is not a standard GNU header. What exactly is provided by tchar.h so that I can find a way to workaround this problem and get it compiled?
Thanks,
Jose
|
|
|
|
|
Good catch. I wrote this class a LONG time ago, and admittedly, C++ is not my first language. I initially wrote the class on a Linux system, and then moved it to a Windows system and tweaked it some more from there, and guess that's where I messed up.
Anyway, tchar.h is a Windows compiler specific thing - thus making this *not* truly cross platform, at least, "as-is". But don't fret too much - all it really does is automatically decide if something should either be a type char or wchar_t. I think I only used the char type in this class if I remember, so just import whatever you need to support type char.
A lot of people have sent me bug fixes and stuff for this class, and one of these days I really need to include them. Thanks for catching this, I'll try to include that in the bug fixes when I get around to updating the code.
-Todd Davis (toddhd@gmail.com)
|
|
|
|
|
the "operator()" of AscendingSectionSort, DescendingSectionSort, AscendingRecordSort, DescendingRecordSort
should add "const", such as
bool operator()(const Record& Start, const Record& End) const
Or, you will got the compiler error under the linux.
-- modified at 7:40 Thursday 16th March, 2006
BTW, good job
|
|
|
|
|
|