General C++ Programming - May 2009 (Page 8)

by stroem
Resizing dynamic array?
 
how do I resize dynamic array without using loop? (And I dont want too use std::vector). loop version: int size = 10; int* arr = new int ; void resize(...
[7 replies] Last: Oh yeah, I should not use a new with a malloc. sorry... (by canilao)
generate a deck of cards
 
hay guys im having rouble with generating a deck of cards...im not really sure exactly how i should do it and i was wondering if i could get some help im using ...
[3 replies] Last: canilao has described one possibility. But a card can be uniquely defi... (by Hammurabi)
string to int conversion
 
Hi! I used atoi from stdlib to manage this conversion ... something like this. #include <string> #include <cstdlib> ... int x ; string s; ...
[5 replies] Last: also #include <boost/lexical_cast.hpp> int n = boost::lexical... (by jsmith)
by Disch
Get app path+name
 
Looking for a way to get the executable's full path and filename. *nix solutions in particular, but Windows solutions, if you have them handy, would also be ni...
[5 replies] Last: Yes, if your application is in a PATH directory you'll have to search ... (by Duthomhas)
by vkq123
Function pointers
 
Hi can somebody explain me what this function pointer means... void *(*(*fp1)(int)) ; As I understand this means its is a pointer to a function which ta...
[13 replies] Last: Thanks guys. :)... i understand this was a very difficult one... and t... (by vkq123)
Winsock & Threads
 
Hey There... I am writing a small chat program: 1 host, multiple clients. I managed the message-receiving with an FD_SET and select() to check for new con...
[4 replies] Last: Do you realize any solution , how i could get all the Clients stuff ov... (by Incubbus)
by Karami
unexpected output from binary file.
 
void read () { int buff; fstream bin ("fails.bin", ios::in); while (bin) { bin.read ((char*)&buff, sizeof(int)); cout<<"stat...
[3 replies] Last: Use a struct of 4 ints and read all four ints in at once into the stru... (by PanGalactic)
GUI Windows && Linux
 
Okay, I'm thinking about learning C++, but I was wondering if it was possible to make a GUI using C++, but it has to be able to run on both Windows and Linux(...
[2 replies] Last: Why it's very possible.And very recommended.This way you won't support... (by andrei c)
by nanger
about escape character "\b"
 
for(....) { fprintf(fp,"%d ",..); } fprintf(fp,"\b\n"); as the codes above show, I want to cancel the last blank using \b and then line feed but...
[5 replies] Last: thanks very much for the detailed descriptions! (by nanger)
Assistance needed with NAN
 
Hi all Yet another question from me and hope some one shoots the answer immediately.. very simple though I have been tryin to do a rigid body simulation ....
[2 replies] Last: bang on target........ thanks.. that was the problem .. but now an... (by Sundar0206)
by nanger
what is wrong with my program?
 
Peer::add_link (this=0x8077398, dest=0x80f6630) at /usr/include/c++/4.2/bits/stl_deque.h:1055 1055 if (this->_M_impl._M_finish._M_cur (gdb) s 56 p_...
[11 replies] Last: I haven't modified p_out_links class Link { PPeer l_to; //... (by nanger)
Static Casting is not working.What can be bug in it?
 
hi everybody . I am trying to use static casting to downcast it .but its not working.Plz help me to find the bug in it . #include<iostream> #include<typein...
[6 replies] Last: I don't often use typeid() (by "often" I mean "ever"), so I had to lo... (by Disch)
by nanger
erros in debugging
 
void make_random_neighbourhood(POverlay po, size_t degree) { size_t n = po->num_peers(); for (size_t i = 0; i < n; i++) { size_t k = 0; while (k <...
[4 replies] Last: What level optimization level did you compile at? The compiler will f... (by PanGalactic)
flush cin
 
Hi How can i flush cin so that i can read a string with spaces after reading an int? #include <iostream> #include <string> using namespace std; int main()...
[4 replies] Last: That's more like it. Thanks (by graciano)
inpout32 in Turbo C ??
 
Hi I am developing a project that hass to access the pc parallel port in windows xp, through Turbo C/C++.. I know u cannot access the port directly in XP but...
[no replies]
Reserve Memory for GMP Integers?
 
I'm working on an algorithm which calculates the square root of 2 to many decimal places. I'm iterating a pair of integers which get very large, and I think I h...
[2 replies] Last: I have read the relevant sections of TFM and strangely enough, there's... (by Mozza314)
Including scripting support in C++ application
 
Hi! What scripting language would You recommend from the set of Python, Common Lisp, Scheme to be used in a C++ application? The main aspect to consider should ...
[10 replies] Last: Got it working. Thanks. (by Repentinus)
Function pointer question
 
I found this code in an open-source project: char* address; // (...) return (void*)*(unsigned int**)(address+0x44); What does this mean?
[1 reply] : that casts address+0x44 to a pointer to pointer to unsigned int and ... (by Bazzy)
c++ class implication problem
 
Question Details: I am having difficulty implimenting these umls. I dont even know how to start. Please help. uml1 Item -string name -int cost -int quant...
[no replies]
What should I do if malloc() fails?
 
I was wondering what I am supposed to do if malloc() returns NULL. Currently the program shows an error message to the user, and stops with whatever it was doin...
[4 replies] Last: In my experience (UNIX) it is MOST important to handle malloc failures... (by jfq722)
May 2009 Pages: 1... 678910... 17
  Archived months: [apr2009] [jun2009]

This is an archived page. To post a new message, go to the current page.