Definitely, it helped at least in half a problem. The rest lays in XML entities like &_amp_; (without underscore). I think I should treat them manually. Generally, mbstowcs
won't help. I had to use win32 function where I can define more encoding standards.
liquid_
Posts
-
How to open file with single quote in its name? -
How to open file with single quote in its name?Additionally, here is what I see in debugger window as contents of the variable which contains the file name: "Baby,_I’m_Not_Sure_If_This_Is_Love.mp3"
-
How to open file with single quote in its name?Well, maybe. I read the name of file from another text file which is windows media player list (.wpl). E.g. I can't open file named "Baby,_I’m_Not_Sure_If_This_Is_Love.mp3" but this "05 - Cold Hearts.mp3" can be opened. There may be issue with encoding characters in the list but how it is possible that some files can be opened and others cannot from the same list. Of course, all files are playable by WMP.
-
How to open file with single quote in its name?Under Windows, I try to open file which name contains apostrophe or some letters in language other than English. In these cases
fopen
orCreateFile
(from W32 library) fail to open it. How should I do that task? Wide character type,wfopen
or defining UNICODE don't help. The functions say the file doesn't exist. -
C++ - code executed upon definite program terminationThanks for all replies. Anyway, the solution requires quite tricky programming.
Heng Xiangzhong wrote:
for example, i want execute a piece of code behind the all of objects' destruct function is invoked.
...and is right. I would say it looks much more difficult than using simple
atexit()
function and I wonder why. Probably it belonged to early C standard libraries and no one invented anything better at C++ times. I'm not sure whether dll is a solution because the same question remains: if I'd like to execute some code after all static objects in dll are disposed, I'd come to the same point of interest. -
C++ - code executed upon definite program terminationI'd like to have a piece of code executed upon definite end of a program.
atexit()
is not appropriate because there may be some code executed when destructing static objects and this function does things beforehand. -
[SOLVED}stack vs. heap objects: how to destruct only heap ones?I think I've just found pretty good solution which, however, may not work well in multithreaded environment. Let's add a static variable
bool heapcreated
, a flagcreatedflag
and overload operatornew
. That would look like this:class sometype
{
protected:
static bool heapcreated;
bool createdflag;
public:
sometype()
{
createdflag = heapcreated;
heapcreated = false;
}
bool IsHeapCreated()
{
return createdflag;
}
void *operator new(size_t n)
{
sometype *stp=::new sometype;heapcreated = true; return stp; }
class container
{
public:
container(sometype *itp)
{
item = itp;
}
~container();
{
if (item->IsHeapCreated())
delete item;
}
private:
sometype *item;
};The new destructor of
container
would behave different depending on mode ofsometype
creation. I've searched this solution to be used when you build a library and you do not want a caller to have to do an overhead work adding a flag parameter. If you had to make many calls tocontainer
constructor with pointers tosometype
it would be slightly difficult to save somewhere the pointers and then delete them. Also, you should be able to pass a pointer to stack variable which must not be deleted explicitly. It's a bit tricky but my simple test works. -
[SOLVED}stack vs. heap objects: how to destruct only heap ones?Suppose we have a class:
class container
{
public:
container(sometype *itp)
{
item = itp;
}
~container();
private:
sometype *item;
};It's possible to use the class object in these ways:
void function()
{
sometype item;
sometype *pitem;container ct1(&item);
pitem = new sometype;
container ct2(pitem);
}I'd like to destroy sometype pointer in class's destructor provided it was created on the heap by new operator but not that on the stack. How to make it?
-
Employment agreements - written or not?In case you want some vacation or are sick or need a free day, what rules apply? State or federal law or talk to the boss? I live in Europe where written contracts are standard and verbal are even penalized in some circumstances.
-
Employment agreements - written or not?Now, I'd like to ask what is KSS? Anyway, I wonder why someone who runs a private legal practice tells "the biggest lie ever". I thought that there was at least a little bit truth in it. Things aren't so bad as in mentioned text then.
-
Employment agreements - written or not?Just here: http://www.asktheheadhunter.com/gv050701.htm[^]
-
Employment agreements - written or not?employment agreement - contract between employer and employee
-
Employment agreements - written or not?I've read somewhere on the net that employees in US mostly do not have a written employment agreement. Is that really so? How about developers and programmers?
-
Graphics.lib - that old oneDoes anybody remember a graphics library shipped with older MS C compilers? Is there available something similar to that one, maybe in (open) source version?
-
theory needed for a described algorithmLet me show this on the example: You're given x1=22 x2=50 x3=100 and d=10 We can find v=15 which satisfies this: we can divide the range <0,100(or at least)> into equal intervals of length 15 because our "10" fits in: 1*15 and 2*15 with the middle in 22 i.e. <17,27> 3*15 and 4*15 with the middle in 50 i.e. <45,55> 6*15 and 7*15 with the middle in 100 i.e. <95,105> I hope it's clearer now and excuse me if the latter was not.
-
theory needed for a described algorithmRight. I should write: xi > d. I know that it is not solvable in any case of d and set of xi. It would be interesting to find limitations when it is.
-
theory needed for a described algorithmThe problem is: given a set of numbers: xi > d and xi+1 > xi and xi+1 - xi > d, i=1..N and "distance" d find such the greatest number v which satisfies the condition for each xi-d/2 and xi+d/2 to be entirely included between kv and (k+1)v where k is integer > 0. I found an empiric algorithm first to be evaluated manually in spreadsheet and then I coded it but I am not sure whether it is reliable without some theory.
-
iterator default value [modified]Well, it is obvious it has no special value as
int val;
. The problem is how to check this. I'll try the below code:#include "list"
#include "map"
#include "iostream"using namespace std;
int main()
{
list::iterator it,itnull;
map::iterator> imap;it = imap\[1\]; //map creates entry with key '1' and default constructed iterator if(it==itnull) //checking with other default constructed iterator cout<<"it unitialized"<
-
iterator default value [modified]How can I check whether an iterator was assigned a value or not? In other words, if I create an iterator with default constructor what value will it present which I could check against? It is not the trivial case such this:
list::iterator it; //what does it contains?
but this:
map::iterator> aci;
AClass *ptr=someinitializedaclassptr;
if(aci[ptr]==UNINITIALIZED_ITERATOR)
{
dosomething();
}In above example issuing
aci[ptr]
creates already an entry in the map with default constructed valuelist::iterator
if there isn't a key of valueptr
.modified on Friday, August 5, 2011 7:48 AM
-
SOLVED - How to concatenate column values of type text during SELECT...FROM...GROUP BY? [modified]With MS Access I had to use VB function which does similar thing. Anyway thanks for an idea.