473,799 Members | 3,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C / C++ Forum

C / C++ programming language - Get answers to questions about compilers, visual C++, templates, namespaces, classes, data structures, OOP (object-oriented programming), inheritance, data types, exceptions, Standard Template Library (STL) and the C Standard Library.
3
1,569
thread by: param | last post Feb 23 '06 by: Ivan Vecerina
Hi, I need to write a MACRO which helps to call different functions depending upon it's value say On or OFF. If its' value is ON the function1 should get called and if value is OFF function2 gets called . It's like same as assert gets executed when NDEBUG is not defined at the start of code. If NDEBUG is defined assert doesn't gets called...
1
1,466
thread by: jesper | last post Feb 23 '06 by: Alf P. Steinbach
Hi. This might be to basic, or of topic, or just plain silly. But, Is there a nice way to construct objects dynamically from a data stream (file, socket, memory) without prior enumerating classes? With enumerating classes I mean solutions like: (pseudo code 1) class B {
4
5,172
thread by: kernelxu | last post Feb 23 '06 by: kernelxu
Hi,folks. I got some suggestion about bitwise shift from <The C Book, second edition>(written by Mike Banahan, Declan Brady and Mark Doran, originally published by Addison Wesley in 1991. This version is made freely available at http://publications.gbdirect.co.uk/c_book/) ....snip... The position is clearer if an unsigned operand is right...
1
1,625
thread by: ken.carlino | last post Feb 23 '06 by: Victor Bazarov
Hi, I have the following code which comples: bool contains(vector<A*>& cgl, A* cg) { vector<A*>::iterator iter = find_if ( cgl.begin(), cgl.end(), bind( equal_to<A*>(), _1, cg )); return (iter != cgl.end()); }
1
2,546
thread by: siegfried | last post Feb 23 '06 by: siegfried
The std::lower_bound function requires a function pointer as its last argument. This is simple if you don't overload. How do I I call std::lower_bound with the last argument a function pointer when I need to pass a certain instance of an overloaded function? Thanks, Siegfried
20
2,562
thread by: mayershome | last post Feb 23 '06 by: Mark F. Haigh
Hi! I'dont have any experiences in programming... what language should I start learning???? C? C++ or Java`? greetz
19
352
thread by: centurian | last post Feb 23 '06 by: Csaba
I have compiled following program with g++/gcc 3.3.1 and "MS Visual C++ 6" and it ran without any errors. Does this thing make any sense? Is it of some use or some problem with grammar/CFG of c/c++? #include <stdio.h> int func() { int x; return x,x; }
3
4,419
thread by: John | last post Feb 23 '06 by: kanze
Is there a good implementation of the boss-worker model in C++ using pthreads? I have an array of objects A that each need processing and I have p threads running simultaneosly. Any object can be processed by any thread. All objects need to get processed. Does anyone know of a good design/implementation of this problem in C++? Thanks a...
26
1,681
thread by: ashu | last post Feb 23 '06 by: pete
lets look at the code given below here i m trying to do mudular programming /* this is my main prog.*/ /*mmod.c*/ #include<stdio.h> #include "mod1.h" int main(void) {
2
9,940
thread by: szabi | last post Feb 23 '06 by: benben
Hi! I have seen in a couple of libraries that object are never passed through dll boundary, instead the results are returned through an output parameter reference like: void f(std::string &s) { s = "foo"; }
2
6,161
thread by: bobrics | last post Feb 22 '06 by: Rod Pemberton
Hi, I would like to create a packet for a RAW socket transfer. Please let me know if this is the right approach. 1. First, I am creating a header structure where I store all the information I would like to put in the header of a packet. 2. I know the size of data I will send and the header size in bytes, so I allocate the space in memory...
31
1,561
thread by: amruta | last post Feb 22 '06 by: Rod Pemberton
hi, i m new in programming.at present i m learning computer languages. i just want to know how u can develop a skills of any language, how u can be master in any languages. can any one help me.
2
378
thread by: jortizclaver | last post Feb 22 '06 by: Keith Thompson
Hi, I have a very simple library that wraps a Timer class and a test program linked to it. First of all, I compile the library and the main without the KPIC flag. Then, I execute the program and, while it's running, I add some dummy sentence to the library and recompile it. Nothing happens to the binary running. It keep unaware of...
16
4,441
thread by: Martin Jřrgensen | last post Feb 22 '06 by: Ben Pope
Hi, I get this using g++: main.cpp:9: error: new types may not be defined in a return type main.cpp:9: note: (perhaps a semicolon is missing after the definition of 'vector') main.cpp:9: error: two or more data types in declaration of 'set' I don't really see the problem... Here's the code:
26
36,091
thread by: LuB | last post Feb 22 '06 by: Bo Persson
This isn't a C++ question per se ... but rather, I'm posting this bcs I want the answer from a C++ language perspective. Hope that makes sense. I was reading Peter van der Linden's "Expert C Programming: Deep C Secrets" and came across the following statement: "Avoid unnecessary complexity by minimizing your use of unsigned types....
8
3,065
thread by: Plissken.s | last post Feb 22 '06 by: TB
I have a template function which print out the content of a list: The following compiles: void PrintInt2 (int i) { cout << i << " "; } template <class T> void printList(T& list) {
3
16,063
thread by: Allan A. | last post Feb 22 '06 by: mlimber
Hi all. Is there any way to initialize an entire array in the constructor. The code below does not work. Thanks. class x { public: int array; x(); };
8
1,464
thread by: kathy | last post Feb 22 '06 by: Tomás
If I have 2D array like: int **p; p = new int*; for(int i=0;i<10;i++) { p = new int; }
1
2,156
thread by: cmazur | last post Feb 22 '06 by: cmazur
I'm currently getting a illegal direction error when using the following code. The error is coming up when I set up the for loop int saveBook(vector<Address*> a, ofstream& out) { //For loop that writes to the temporary file in the correct //format in order for it to be read in to the progam again //cout << (*a).size(); ...
2
1,970
thread by: cdg | last post Feb 22 '06 by: cdg
Could anyone tell me why a function return with this program is not returning to "main". The program will compile and should be self-explanatory. And any suggestions for improvements would be appreciated also. The function is HashMilliTime at the end of the program. #include <sys/timeb.h> #include <iostream.h> #include <string.h>...
7
3,519
thread by: Peter Jansson | last post Feb 22 '06 by: siegfried
Dear group, I have been struggling to get a simple program for inserting and extracting std::tm objects to/from streams to work. The code below tries to read a std::tm object from a std::istringstream but fails to do so, could anybody see what is wrong with the code? (Output follows the code.) I fear that I have not completely grasped how...
4
5,826
thread by: riya1012 | last post Feb 22 '06 by: Default User
hello guys, I need some help from you. I am doing a DSP project and for that I need to do some C coding for the conversion of sample data which is in floating point representation to fixed point representation. the sample data is in floating point like 0.224128 2.299965 0.448350 -1.779926
2
1,605
thread by: andrew queisser | last post Feb 22 '06 by: Walter Roberson
Hi all, I'm working on a small embedded system (think microcontroller with uC/OS-II) and I'm considering which convention to use for error handling in our internal "API". Since I'm using two existing APIs (a low-level HAL and the OS API) I already have mixed conventions since some return 0 for failure, some return 0 for "no-error", etc. ...
19
2,373
thread by: felixnielsen | last post Feb 22 '06 by: Daniel T.
Some might remember that i, not so long ago, started a treath or two about a weird 3d labyrinth. I now have a working code, that i want to share, hear comments, advice, ect., but first let me explain what its all about. The whole labyrinth is a cubic in its self and it contains x^3 cubic rooms. The labyrinth is infinite/finite, it has no...
2
3,801
thread by: aimal | last post Feb 22 '06 by: roberts.noah
Hi, I am writing a program that needs to read the screen resolution and then size a window according to it. My program will run on linux machines. Can anybody help me on how it can be done? Thanks Aimal

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.