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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
A

abbiyr

@abbiyr
About
Posts
5
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • type conversions
    A abbiyr

    Hi there. While sprintf works, it is really a C solution. I just wanted to show you a C++ solution for creating a string to display by using streams. #include // your numerical data double num1 = 3.143; // an output stream std::ostringstream outStream; std::string outString; outStream << "Value of double is : " << num1; // if you want a standard c++ string from the stream outString = outStream.str(); // VC++ stuff. Lets write the string to a label (need to create a System::String) label1->Text = gcnew String(outStream.str().c_str()); Using the ostringstream, you will not have to worry about the size of your char array, or have a ptr to char and do any memory allocation/cleanup. All done for you. Cheers

    C / C++ / MFC tutorial question

  • Windows Socket Problem
    A abbiyr

    Hi there. You could try using the gethostbyname function to validate the host name when it is entered. This way you could issue a warning if an ip address cannot be determined for the thost name and you would not be resolving hostnames during the connect call. Cheers

    C / C++ / MFC c++ css com sysadmin help

  • converting char to unsigned int
    A abbiyr

    Quite agree. It is not necessary, the unsigned char will be cast correctly without it. I recommended it though, as it does explicity show the intentions of the developer.

    C / C++ / MFC question

  • socket question
    A abbiyr

    Hi there.

                ----Client 1         
    
    Server --------+---Client 2
    ------
                ----Client 3
    

    Two solutions come to mind. My assumptions . your server is acting as a proxy - i.e. clients 1,2,3 only talk to the server, not directly to each other. . client 1 is only ever a socket client, it does not listen for a connection . client 2,3 have sockets open waiting for a connection from the server. Firstly, if you want one socket listening on your server, you will have to inspect the messages. No sign message The steps, . Client 1 sends message . Server (starting a new thread for the connection) inspects message and opens a connection a connection to client 2 and sends message to client 2 . Client 2 ACKS message to Server . Server ACKS message to Client 1 Sign on request message . Client 1 sends message . Server (starting a new thread for the connection) inspects message and opens a connection a connection to client 3 and sends message to client 3 . Client 3 signs and returns to the message to the server. . Server opens a connection a connection to client 2 and sends signed message to client 2 . Client 2 ACKS message to Server . Server ACKS message to Client 1 Alternatively, if you use two different sockets on your server, one for signed messages, one for normal messages, then you will not have to inspect the messages on the server. Remember to use threads when accepting your socket connections. Hope this helps concrete your design. Cheers

    C / C++ / MFC help sysadmin xml tutorial question

  • converting char to unsigned int
    A abbiyr

    Hi there. As the other replies have stated, you need to use the unsigned char for values above 127. To perform explicit conversions in C++, you should use the static_cast instead of the old C-Style casts. unsigned char c = 250; int a = static_cast<int>(c); Cheers

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