Search:

Type: Posts; User: megatron09

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    987

    Quick question about new and delete

    Considering c++ doesnt implement automatic garbage collection I understand that its a good idea to keep tight control of memory usage. I know that you can initialise a variable using the new and then...
  2. Replies
    12
    Views
    3,200

    I think I could solve this using a for loop....

    I think I could solve this using a for loop. However I would need to know how to empty and resize a character array. Here is a quick sketch of what I was thinking of doing...


    //Sends a string of...
  3. Replies
    12
    Views
    3,200

    I wouldnt normally have the += but i've been...

    I wouldnt normally have the += but i've been messing around with the code and forgot to switch it back properly. ;)
  4. Replies
    12
    Views
    3,200

    Its not that I cant pass strings to send() The...

    Its not that I cant pass strings to send()

    The problem is that i'm trying to pass a specific 8-byte 'header' packet. This has to be done correctly so that the server can pick it up and split it...
  5. Replies
    12
    Views
    3,200

    According to this...

    According to this its..

    int send(int sockfd, const void *msg, int len, int flags);
    However if I pass anything other than char the compiler will give me..

    94 C:\xmlgbx\gbx\socketwrap.cpp cannot...
  6. Replies
    12
    Views
    3,200

    I cannot use std::string at all for some reason....

    I cannot use std::string at all for some reason. When I do it somehow corrupts the 8-bytes and all communication with the server breaks down.

    One other thing, the code I posted above it slightly...
  7. Replies
    12
    Views
    3,200

    Character array substring.

    I have written a program that communicates with a server via sockets. To make my life easier I created a 'socket' class which takes care of all the low-level socket stuff. One of the methods is...
  8. Replies
    14
    Views
    1,463

    I know i'll probably get sneered at for...

    I know i'll probably get sneered at for suggesting this, but try learning something easier first. I started to learn programming from scratch only a few months back, and my first choice was python. ...
  9. Replies
    14
    Views
    5,066

    I appreciate your advice Mario, but I just wanted...

    I appreciate your advice Mario, but I just wanted to know incase there was a situation where I had to explicitly unlock a mutex. I doubt there is, and i'm sure another method could be devised where...
  10. Replies
    14
    Views
    5,066

    Thanks Mario, that helps a lot :) The reason I...

    Thanks Mario, that helps a lot :)

    The reason I was so puzzled was due to me not understanding all the jargon just yet ;)

    When 'destructors' and 'scope' were mentioned as being the conditions in...
  11. Replies
    14
    Views
    5,066

    Thanks, that clears things up a lot. I can see...

    Thanks, that clears things up a lot. I can see why std::cout would need to be locked, as i'm guessing that allowing two threads to write to the output stream at one time would produce a mangled mess...
  12. Replies
    14
    Views
    5,066

    Threading and mutex's

    I am building a multi-threaded c++ app using the boost::thread library. I am just a bit confused about when I should be using locks and mutex's. I understand that it is essential that global objects...
  13. Replies
    13
    Views
    2,119

    Thanks for the info, just a few questions.. ...

    Thanks for the info, just a few questions..


    How do you mean the union is overkill? Does it need more memory or resources to work? I will probably use your suggestion regardless since you pointed...
  14. Replies
    13
    Views
    2,119

    Thats ok, as long as it contains the correct...

    Thats ok, as long as it contains the correct binary value to send through a stream socket. It doesnt need any string methods. Thanks for clarifying that.
  15. Replies
    13
    Views
    2,119

    Will this work both ways, i.e if i assign values...

    Will this work both ways, i.e if i assign values to 'size' and 'handle' will 'bytes' contain the correct value?
  16. Replies
    20
    Views
    19,837

    Yeah its a tricky concept to grasp after coding...

    Yeah its a tricky concept to grasp after coding scripted languages for all this time. I'm starting to get the hang of it now however ;)
  17. Replies
    20
    Views
    19,837

    Just found out what that means. Good idea thanks...

    Just found out what that means. Good idea thanks - sorry i'm a newbie to this ;)
  18. Replies
    20
    Views
    19,837

    Okay, i've tried writing a function template to...

    Okay, i've tried writing a function template to take arguments of varying numbers and types. It didnt go so well. Here is what it looks like..


    std::string XmlGbx::parseString(std::string pstr){...
  19. Replies
    20
    Views
    19,837

    This is a nice solution. However I will probably...

    This is a nice solution. However I will probably stick to the template function. The engine doesnt need to be entirely generic as I know exactly what kind of calls I can expect. It is not designed to...
  20. Replies
    20
    Views
    19,837

    Ah, that helps a lot. Thanks! :) EDIT: How do...

    Ah, that helps a lot. Thanks! :)

    EDIT: How do I check if the parameter has been left out. Say if I use the int method, what if an int value is passed to that param. If it is an un-used param i'm...
  21. Replies
    20
    Views
    19,837

    Because there are many possible combinations of...

    Because there are many possible combinations of types used and the order they will be in (the order is important). So i'm not sure what your code does but if it does the same thing then I may use it....
  22. Replies
    20
    Views
    19,837

    I've just read up on overloaded template...

    I've just read up on overloaded template functions and I think i'll do it this way. The only problem is I need a way to tell what type i'm handling when the the argument is processed, so it can be...
  23. Replies
    6
    Views
    4,101

    This (http://wordlist.sourceforge.net/) may help.

    This may help.
  24. Replies
    20
    Views
    19,837

    I'll have a look at boost::any although I was...

    I'll have a look at boost::any although I was hoping it was possible within the standard library.

    The reason I need this is that i'm building an xmlrpc client to communicate with a server. I want...
  25. Replies
    20
    Views
    19,837

    Multiple types in lists, vectors or arrays.

    I learnt to program in python and php, so i'm used to having dynamic and associative lists (php's array, and pythons dictionary). As c++ requires you define the type of each variable, and define the...
Results 1 to 25 of 28
Page 1 of 2 1 2