Search:

Type: Posts; User: C+/-

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    936

    Thanks ralu, I'm using a language very similar to...

    Thanks ralu, I'm using a language very similar to C but which has an abs function that is overloaded for many types.


    Anyway, I found a solution:
    if(abs(a - (ctr % 32)) <= threshold)
    ...
  2. Replies
    2
    Views
    936

    Cycling variable, threshold

    Hi there,

    I have a float called counter that goes from 0 to 31 and then back to 0. I want to be able to specify a number x (0-31) and a threshold th, and check if the number is within th units...
  3. Replies
    1
    Views
    1,195

    Visual studio 2005 pro question

    Hello there,

    This is my situation: I have a solution with several projects. Most of these projects depend on a certain library that is installed in a direction on a higher level than the solution...
  4. Replies
    2
    Views
    2,109

    Console app termination

    Hello, I'd like to know how I can cleanly terminate my C++ console application under windows.

    I have a while(true) loop in my code, that keeps polling and Sleep()'ing forever. When I click the...
  5. Thread: Output formatting

    by C+/-
    Replies
    3
    Views
    913

    Thanks mats, but I need a method where the output...

    Thanks mats, but I need a method where the output producing code is unaware of the indents. I guess that's not possible.
  6. Thread: Output formatting

    by C+/-
    Replies
    3
    Views
    913

    Output formatting

    Hello,

    Is it possible to tell cout that from now on, all output must be indented with n spaces?

    For example:
    cout << "blahblah" << indent(3) << endl;
    cout << "abc" << endl;
    cout << "123" <<...
  7. Thread: time_t troubles

    by C+/-
    Replies
    3
    Views
    1,471

    Thanks, matsp! I knew about the 1 jan 1970...

    Thanks, matsp!

    I knew about the 1 jan 1970 thing, but somehow it didn't occur to me when debugging this problem.. Thanks for pointing that out.
  8. Thread: time_t troubles

    by C+/-
    Replies
    3
    Views
    1,471

    time_t troubles

    I have a string with the following contents: "1950-01-01 00:00:00".

    I have the following code. It should create a time_t object from the string. But it crashes and I don't understand why..


    tm...
  9. Replies
    13
    Views
    1,223

    Was searching for the problem for hours, and then...

    Was searching for the problem for hours, and then minutes after I posted I found the problem. Sorry about that.


    The problem was that I had a subclass pointer pointing to a base class instance. I...
  10. Replies
    13
    Views
    1,223

    std::string problem

    Hello,

    I have a problem with an std::string that is a member of a class.

    It is simply declared in the public section of my class like this: "string s;". The class is does not have a cpp file...
  11. Replies
    4
    Views
    900

    Thank you :)

    Thank you :)
  12. Replies
    4
    Views
    900

    So this is ok? getIPStr(SystemID...

    So this is ok?




    getIPStr(SystemID systemID)
    {
    stringstream ss;
    ss << "SystemID: " << systemID
    << "IP: " << (net->getSystemAddress(systemID)).ToString(true);// << endl;
  13. Replies
    4
    Views
    900

    std::cout / streams question

    Hello, I have several cout statements in my code, that all have to print similar strings.

    Example:


    std::cout << "WARNING: corrupt CHARACTER_LIST_REQUEST packet received from: \n"
    ...
  14. Replies
    1
    Views
    1,151

    Calling member function from pointer

    Nevermind, I've solved it. Sorry
    Solution:
    using boost.bind:
    bind(eventFunction, loginServer, _1, _2, _3)(data, dataLength, sourceSystem);


    I have the following problem:
  15. Thanks, brewbuck. I'll go with the class...

    Thanks, brewbuck. I'll go with the class hierarchy.

    One last question, though. Does the template method you where thinking about require the user of the library to create his own subclasses? If...
  16. I'm not sure. I don't understand what you mean by...

    I'm not sure. I don't understand what you mean by "opaque pointer". What is an opaque pointer in this context?

    Also, in order for the library to pass an object to the callback, it has to store it....
  17. I've written the library myself, so it's...

    I've written the library myself, so it's relatively easy to change.

    The exact prototype is:
    void setEventFunction(MessageID messageID, PacketHandler packetHandler);

    where PacketHandler is:...
  18. Callbacks, allowing ptr to member with arg. binding

    I'm using a library where to I can pass a function pointer which is later called by the library. I would like to be able to pass a pointer-to-member instead of a normal function pointer to the...
  19. Replies
    5
    Views
    1,055

    Hmm, I guess the strncpy_s makes it non-portable?...

    Hmm, I guess the strncpy_s makes it non-portable? Do you have a suggestion for a portable and safe alternative?

    The return value indicates what to do with the packet that fired the event. I want...
  20. Replies
    5
    Views
    1,055

    Thanks, how about this: I've changed the...

    Thanks, how about this:

    I've changed the packet format a bit. The first byte is still the message type, then followed by 6 characters for the account number, followed by 1 to 20 characters for the...
  21. Replies
    5
    Views
    1,055

    Safe string copying

    I'm doing some network programming, and I'd like you to review a small piece of code. I want to know if this is safe (regarding bufferoverflows and other security risks).

    I'm getting an unsigned...
  22. Thread: Header in header

    by C+/-
    Replies
    6
    Views
    1,007

    Thanks for the super fast replies, guys. I'll...

    Thanks for the super fast replies, guys. I'll follow vart's (and others') advice.
  23. Thread: Header in header

    by C+/-
    Replies
    6
    Views
    1,007

    Header in header

    Hello, I'd like to know if it is considered bad practice to include a header (.h) in another header. Is it? Why?
  24. Replies
    1
    Views
    771

    Virtual function optimization

    I'd like to know if compilers can optimize the following code. I'm interested in MSVC++ and g++.



    class Base
    {
    virtual void doSomething() = 0;
    };

    class Derived : public Base
  25. Replies
    1
    Views
    713

    Updating a dll used with import library

    Hi,

    This is a Windows/VC++ specific question. Is it possible to replace a dll with a new version of that dll, if the dll is linked to an application with an import library? I don't want to have to...
Results 1 to 25 of 69
Page 1 of 3 1 2 3