- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
6 Posted Topics
Re: [QUOTE=Chilton;1611677]If you would like to return a newly generated "array" from a function, you can create a pointer to that type and dynamically allocate space for the array, within the grav_force function, set its values, then return its address. ...[/QUOTE] In general, it is bad programming practice to allocate memory … | |
Re: Using a trick I borrowed from [URL="DANIWEB"]http://www.daniweb.com/software-development/cpp/threads/41594[/URL], I did the following: [CODE] #include <iostream> #include <set> using namespace std; template <typename T, int N> char (&array(T(&)[N]))[N]; int init[] = {1, 2, 3, 4, 5, 6, 7, 8, 9 }; set<int> myInts ( init, init + sizeof array ( init ) … | |
Re: The [B](*nodo)[/B] is because malloc() is declared like so: [CODE]extern char * malloc();[/CODE] so you must cast to [B]nodo *[/B] to make the compiler happy. | |
Re: The problem may be related to the [CODE] dact_line.append(buffer); [/CODE] Assuming dact is a std::string, then the buffer will be copied completly until the first NULL terminator. You should only be appending the number of bytes read, not the entire buffer. Use [CODE]string& append ( const char* s, size_t n … | |
Re: Do you mind posting the actual error text? It may provide more hints. | |
Re: I've just started playing with boost and have implemented both the async server and client sides. One thing that I see wrong is the declaration of io_service inside of start_accept(). The io_service must exist outside start_accept so that you can eventually call io_service.run() and actually perform the accept(). |
The End.