Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

liquid_

@liquid_
About
Posts
76
Topics
23
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to open file with single quote in its name?
    L liquid_

    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.

    ATL / WTL / STL help tutorial question

  • How to open file with single quote in its name?
    L liquid_

    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"

    ATL / WTL / STL help tutorial question

  • How to open file with single quote in its name?
    L liquid_

    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.

    ATL / WTL / STL help tutorial question

  • How to open file with single quote in its name?
    L liquid_

    Under Windows, I try to open file which name contains apostrophe or some letters in language other than English. In these cases fopen or CreateFile (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.

    ATL / WTL / STL help tutorial question

  • C++ - code executed upon definite program termination
    L liquid_

    Thanks 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 / C++ / MFC c++

  • C++ - code executed upon definite program termination
    L liquid_

    I'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.

    C / C++ / MFC c++

  • [SOLVED}stack vs. heap objects: how to destruct only heap ones?
    L liquid_

    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 flag createdflag and overload operator new. 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 of sometype 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 to container constructor with pointers to sometype 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.

    C / C++ / MFC visual-studio docker data-structures tutorial question

  • [SOLVED}stack vs. heap objects: how to destruct only heap ones?
    L liquid_

    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?

    C / C++ / MFC visual-studio docker data-structures tutorial question

  • Employment agreements - written or not?
    L liquid_

    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.

    The Lounge question

  • Employment agreements - written or not?
    L liquid_

    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.

    The Lounge question

  • Employment agreements - written or not?
    L liquid_

    Just here: http://www.asktheheadhunter.com/gv050701.htm[^]

    The Lounge question

  • Employment agreements - written or not?
    L liquid_

    employment agreement - contract between employer and employee

    The Lounge question

  • Employment agreements - written or not?
    L liquid_

    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?

    The Lounge question

  • Graphics.lib - that old one
    L liquid_

    Does anybody remember a graphics library shipped with older MS C compilers? Is there available something similar to that one, maybe in (open) source version?

    C / C++ / MFC graphics question announcement

  • theory needed for a described algorithm
    L liquid_

    Let 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.

    Algorithms algorithms help

  • theory needed for a described algorithm
    L liquid_

    Right. 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.

    Algorithms algorithms help

  • theory needed for a described algorithm
    L liquid_

    The 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.

    Algorithms algorithms help

  • iterator default value [modified]
    L liquid_

    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"<
    
    ATL / WTL / STL question tutorial

  • iterator default value [modified]
    L liquid_

    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 value list::iterator if there isn't a key of value ptr.

    modified on Friday, August 5, 2011 7:48 AM

    ATL / WTL / STL question tutorial

  • SOLVED - How to concatenate column values of type text during SELECT...FROM...GROUP BY? [modified]
    L liquid_

    With MS Access I had to use VB function which does similar thing. Anyway thanks for an idea.

    Database database tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups