473,543 Members | 2,035 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.
7
2,739
thread by: Plissken.s | last post Feb 25 '06 by: Dave Townsend
Hi, If I define a template wich uses the __FILE__ marco in a .h file and I have class which creates/uses that template (in a .cpp file). What will the __FILE__ marco expand to? the .h which defines the template? or the .cpp file which uses the template? Thank you.
7
7,154
thread by: Plissken.s | last post Feb 25 '06 by: Alf P. Steinbach
Hi, How can I find out the index of a vector which has the min element? I know how to find out the * value * of a vector which has the min element. But how can I find out its index? for example, , I would like the function to return 2. Thank you.
9
7,652
thread by: Chen Shu | last post Feb 25 '06 by: Micah Cowan
Hi there: These days I came to a problem that I failed to convert a binary number to a hex number using a macro. For example: int a = BINARY4(0101) will become int a = 0x5; int a = BINARY8(0001,0101) will become int a = 0x15; ...etc. I've written the following macros:
0
1,384
thread by: AnonymousFC4 | last post Feb 25 '06 by: AnonymousFC4
1) Debugger. Is gdb (or ddd) still the best tool to debug C++ prog a) on Linux? b) On Solaris? 2) IDE, can you debug C++ programms, using Eclipse-cdt on both Linux and Solaris? Other tools? Thanks.
3
1,306
thread by: Amadeus W. M. | last post Feb 25 '06 by: Greg
I have a class template <class Vector_t> class A; where Vector_t is some sort of vector. I want to provide different specializations for real and for complex vectors. I need the following: // Real vectors: A< valarray<double> >; // templated
5
2,745
thread by: Fei Liu | last post Feb 25 '06 by: Maxim Yegorushkin
Hi, I have a interesting problem here, class absOP{ template<class T> T operator(T val) { return val < 0 ? -val : val; } }; Now the problem is I can't seem to use this overloaded operator, absOP op(..);
1
1,115
thread by: junw2000 | last post Feb 24 '06 by: Victor Bazarov
When we use a derived-type object to initialize or assign a base object, if the base class has private members, how can these members be initialized, since private members can not be inherited? For example, class Item_base { public: int count;
2
1,443
thread by: Robert | last post Feb 24 '06 by: mlimber
I am Robert, an individual Project Manager. I need Experienced Embedded VC++ developers. catch me: mail: energyonboard@gmail.com chat: energyonboard - yahoo, msn, gtalk, aol, icq -Robert
23
2,184
thread by: centurian | last post Feb 24 '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; }
4
4,489
thread by: Raider | last post Feb 24 '06 by: Raider
Is there std::map member-function that do as code below? typedef std::map<NameClass, ValueClass> ParameterContainer; .... // this code is equivalent to "_Parameters = Value", // but a bit faster for insertion <code>
1
1,663
thread by: poison.summer | last post Feb 24 '06 by: Ian Collins
Hello I use the following function to print out the time. But I wonder whether I can be more accurate like print out the microsecond Thanks a lot! void Print_time() { time_t now;
9
1,912
thread by: pranav.choudhary | last post Feb 24 '06 by: Lew Pitcher
I hope the question is not silly. 1. Can there me more than one main in a C program. 2. Can main take more arguments thac argc and argv. If yes then whar are they meant for??
7
11,565
thread by: JustSomeGuy | last post Feb 24 '06 by: Kai-Uwe Bux
I need to make a class called uid. A UID is a unique identifier. It looks like... 1.2.3.345.1.2.4.566 This uid get transmitted over a network as 8 bit binary data. If the length of the UID is odd, an extra padding null \0 is added to the end. This is what I've written but I'm not sure if I've garanteed to have the c_str() method return a...
11
1,642
thread by: roberts.noah | last post Feb 24 '06 by: Default User
I've been buying books from the C++ in depth series and I've been really impressed with all of them so far. Especially practical have been the Exceptional C++ and C++ Coding Standards. I'm buying more right now and want to know about two: Applied C++ Accelerated C++ Accelerated C++ looks like it might be a bit beginner oriented, is...
3
2,123
thread by: Amol | last post Feb 24 '06 by: Kai-Uwe Bux
I am working on an interesting graph optimization problem and I would like to have a few expert opinions for helping me with a solution. So here goes ... I have a black box with a complex internal circuitry that is represented in the form of a graph. I have to abstract the graph by reducing the number of internal points and constructing...
4
1,316
thread by: Freddy | last post Feb 24 '06 by: Emmanuel Delahaye
Hi, I have a C/C++ program.. I'm using a certain file to dump lots of computed numbers in it because I might need to check them later on...so the only way I was able to do that is by "appending" all the data to that file...because if I use the "write" ("w") function..everytime the iteration takes place it will delete the previous data.
7
4,350
thread by: Peter | last post Feb 24 '06 by: Default User
hi all, the strtok() cannot phrase the token within another token, am i correct? For example, i want to get the second word of every row of a file, how to use strok to complete this? thanks from Peter (cmk128@hotmail.com)
9
3,416
thread by: cicalese | last post Feb 24 '06 by: Barry Schwarz
For starters, I am a C novice. I don't fully understand how strings work. I am running on a linux box. I compile w/ gcc. I have a string called 'myabqcommand' that is being overwritten when i use strcat() on some unrelated strings. For this code: char *myabqcommand; myabqcommand = strtok(x, "-");
10
1,225
thread by: bmlclemson08 | last post Feb 24 '06 by: Barry Schwarz
I'm trying to figure out why this program is not printing out the correct mode... suggestions? int main(){ int qty, num, mode, a_1, a_2, sum = 0; float mean; int max_qty = 0; printf ("Enter how many: "); scanf ("%i", &qty);
0
1,113
thread by: Asfand Yar Qazi | last post Feb 24 '06 by: Asfand Yar Qazi
Hi, Is is possible to set the 'policy' of a class by allowing the user to specify a template argument that defines what some functions will be based on the template argument given? Basically, it's the old 'make the user derive from a virtual base class' vs. 'use attachable callbacks (or in this case signals/slots)' problem - and I'm...
7
1,799
thread by: John | last post Feb 24 '06 by: roberts.noah
I want to output the stuff computed using the compiler using template metaprogrms (not at runtime but compile time). An easy example is to output the set of fibonacii numbers at compile time instead of run time. (using maybe error messages/ warnings...? Any other way except the output code generated). Anyone knows if this is possible to...
8
1,612
thread by: ChristophK | last post Feb 24 '06 by: ChristophK
Hallo, this is my first post and I hope I'm doing well, but if not, please let me know. My problem: First all classes and a main-file (I simplified everything to get to the core of the problem): /*---------------- start of code ---------------------------*/
18
12,152
thread by: Kuljit | last post Feb 24 '06 by: Lew Pitcher
I am doing Engineering(B.Tech) in Computer Science. I have a question for which i am struggling to write a C code(program). It struck me when we were being taught about a program which counts the number of digits in a given number. I request to help me out in solving the below said question. Ask the user to enter a decimal/float...
13
2,034
thread by: Nemo | last post Feb 24 '06 by: Nemo
Hello Folks, I need to manipulate a list of char strings as follows, but when I want to delete the pointer created with new at the end, delete operator crashes, any idea? char* list; while(...) { list = new char ; strncpy(list, c_TempFilename, Stringlength);
1
2,270
thread by: Tomás | last post Feb 24 '06 by: Victor Bazarov
dynamic_cast can be used to obtain a pointer or to obtain a reference. If the pointer form fails, then you're left with a null pointer. If the reference form fails, then an exception is thrown. Would "Feed1" or "Feed2" be preferable in the following: #include <iostream>

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.