General C++ Programming - July 2011 (Page 17)

Adding char to an int
 
I was wondering how it was possible to add a array to chars to an int as the function bellow does. Could someone explain this to me? And char *buf is an ARRAY o...
[1 reply] : buf is not a char; it is a pointer to a char. buf+total is adding ... (by Moschops)
Sockets?
 
I was wondering why make an non-blocking socket? What advantage does it provide in comparison to a blocking socket? And you could give me an example of when a n...
[3 replies] Last: Thanks, that summed it up perfectly. (by TheCreator)
Wats the need of a header file?
 
Things can be done, without it to, its only needed for properly management of the code! Am I correct?
[1 reply] : When using a library that is already compiled, you need to provide the... (by Moschops)
I dont find any need of enums?
 
Coz I think, there are many options(like macro, or simply declaring a variable) to enums Am I correct?
[1 reply] : No. Besides the fact that they're assigned values automatically, they ... (by Athar)
When to use #define or const?
 
I was just thinking about some code I had written where I used the #define directive to make musical note names their own frequency. e.g. #define C0 16.35 ...
[5 replies] Last: Ah, thanks for clearing that up. Time to do a large amount of editing... (by Catfish)
Header file Inclusion
 
Hi Which is the better way to include header files. Suppose I have a project containing Example.h and Example.cpp file. Which needs four header file. Head...
[1 reply] : Only include them in Example.cpp, of course. Why on earth would you cr... (by Athar)
by clros
C++0x, thread, promise and future
 
Hello! I am making a simple template class for communication with two thread in C++0x, using the promise and future. My class make a channel to communicate ...
[3 replies] Last: I don't have <future> installed on my machine, so I'm afraid I can't h... (by h9uest)
by MiKom
Member function templates instantiation in gcc
 
Hi, I have a problem with class member function templates. It seems that gcc is trying to analyze the code semantically too early, without explicit template ...
[5 replies] Last: Wow, nice solution. Thanks. (by MiKom)
by Phiru
operator???
 
I am curious about "operator" My book that i'm reading is saying "bool operator==(struct A& val);" What does it mean?? If you have any idea, plz explai...
[2 replies] Last: Thank you mcrist!!! (by Phiru)
by Ares26
Help with the System() Function
 
Hello! I need help with my system() function so I can add arguments. Here is my code: #include "stdafx.h" #include "windows.h" #include <stdlib.h> int ...
[1 reply] : If you really want to do it that way, use sprintf() to put variables i... (by Zhuge)
by alhanz
Modify selected text from a textfile
 
Case Solved..
[5 replies] Last: Thx thou, I think I somehow managed to solve it!! Haha!! (by alhanz)
about c++ classes
 
is it possible that the parameters of the one function is globally used without using any global variable? void myclass::myclass() { /** code here */ } void...
[10 replies] Last: thanks to all of your replies. im doing it on all your samples before... (by xeroblast)
Include the header files in .lib
 
I am learning about .lib (static library) files and I have a big question: When we make a .lib project, we include the header files there, but it looks like on...
[9 replies] Last: Oh, sorry. I typed it wrong. What has happened is I removed the heade... (by soheilghafurian)
by fsshl
no match for 'operator<<'
 
Dear c++ experts: usually the left side of << is ostream or stringstream. but can it be user defined class? I got compile error at place to access it since I...
[3 replies] Last: LB , Thanks your incitation. kooth, That book section 8.3 did not spec... (by fsshl)
Sorting by multiple attributes problem
 
Hi fellow code warriors, I have the following comparison functor : struct sizeSortDescFunctor{ bool operator ()(const Sphere & i, const Sphere & j){...
[7 replies] Last: (If the Sphere object just does a simple member-wise copy, then you do... (by jsmith)
Boost ASIO Serialization
 
Hey Guys, I have problems with serialising Objects of NET. Serialising works fine but when deserialising i get the error "Datastream error". Everything works...
[no replies]
Segmentation fault and new to c++
 
I am getting a segmentation fault whenever I uncomment the call to the method "removeDuplicates". Any help would be appreciated. #include <iostream> us...
[3 replies] Last: That's not being flushed because it segfaults before the buffer is emp... (by Moschops)
by Luffy
Reading only part of the content in textfile
 
Hi all, I have a text file containing these: csc : -212 : 21July2011 salary : 2000 : 28July2011 I would like to only read the 2nd column of th...
[8 replies] Last: Thanks. My problem solved. (by Luffy)
by Luffy
Code crashes while running
 
Hi all, My code crashes halfway while running till the EditCashFlow() portion. It will crash once the user input the choice he want to edit. Below is a l...
[2 replies] Last: My program crash upon hitting this line. cout << "Enter which en... (by Luffy)
Seg fault while accessing data created in another class
 
In my main I have: Volume* myVolume = new Volume(); Geometry* myGeometry = new Geometry(); DataHandler* myData = new DataHandler(); and after the ...
[1 reply] : Volume* myVolume = new Volume(); sigh, ¿Is there a good reason to d... (by ne555)
July 2011 Pages: 1... 1516171819... 30
  Archived months: [jun2011] [aug2011]

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