473,543 Members | 2,496 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.
4
1,504
thread by: kap | last post Feb 15 '06 by: kap
Hi all, I am facing a weired problem when I try using maps. Here is the sample code. Can anyone please tell me where am I going wrong. int main() { less<int> ltvar; std::map<int, int> m2(less<int>()); m2; // compilation fails at this point return 0;
1
2,165
thread by: benben | last post Feb 15 '06 by: Alf P. Steinbach
Say I have a class template: template <typename T> class myclass { public: template <typename U> myclass(void ) {
32
2,544
thread by: santosh | last post Feb 15 '06 by: RSoIsCaIrLiIoA
In following code char str = "asdf" ; str = 's' ; is possible. But char *str = "asdf" ; str = 's' ; is an run-time error. What i understand is *str = "asdf" is stored in Read-only-Memory. Where
6
4,810
thread by: electrixnow | last post Feb 15 '06 by: Aaron Lawrence
in VC++ Express Edi Is their a way to replace one line of TEXT in an existing text file. I now open it then read in the data, once I have found somthing that needs updating, I need to overwrite that one line only and continue reading the rest of the file to check for other line that may need updates.
3
1,821
thread by: prabhu.desai | last post Feb 15 '06 by: Jack Klein
I'm compiling a huge(900 files ) embedded application written in C . Over a period of time , the code has developed a lot of inter crossed dependenc. The current scenario is , i make a change to one header file , it begins to compile all the .c files in the project. Is there a tool/algorithm to remove all the unecessary dependency ? How do...
17
6,390
thread by: joseph.p.doyle | last post Feb 15 '06 by: pete
This code, compiled with visual studio .NET 2003, double a = 95.022, b = 0.01; printf ("%lf - floor(%lf / %lf) * %lf = %.17lf\n", a, a, b, b, a - floor(a / b) * b); a = 95.021, b = 0.01; printf ("%lf - floor(%lf / %lf) * %lf = %.17lf\n", a, a, b, b, a - floor(a / b) * b); a = 95.020, b = 0.01; printf ("%lf - floor(%lf / %lf) * %lf =...
7
2,825
thread by: Martin Jørgensen | last post Feb 15 '06 by: Martin Jørgensen
Hi, Perhaps a stupid question but I wonder if this isn't possible using C: printf("\nOr push <enter> for default (which is theta=%ld)%s", theta, ": "); It would be nicer to have it on one line... (I know this works): printf("\nOr push <enter> for default (which is theta=%ld)", theta);
14
1,852
thread by: akirab | last post Feb 15 '06 by: benben
What is a good and cheap way to get C++ (and OpenGL) development on Windows-XP?
4
6,510
thread by: san | last post Feb 14 '06 by: Larry I Smith
Greetings, I have a C++ problem. I am implementing a signal handler inside a class SignalClass. The code looks as follows: SignalClass is an Singleton class. class SignalClass { private: int assign(int sig); void handler (int sig);
5
2,031
thread by: Matt | last post Feb 14 '06 by: Matt
I am trying to cast an ostream reference to void* and back again. The code below shows the problem isolated from a more complex program. It compiles quietly but seg faults upon execution. // =================================================================== #include <iostream> using namespace std; void myprint(void *s) { (ostream&)s...
5
1,580
thread by: JustSomeGuy | last post Feb 14 '06 by: Pete Becker
According to the docs... http://www.cppreference.com/cpplist/sort.html There is a parameter to the std::list.sort method. I don't understand this methods use... I want to sort the list which is a list of points x,y,z. I have three points involved in the sort... The two points the sort algorithm is providing for comparison and a refrence...
1
1,778
thread by: maxwellkey12 | last post Feb 14 '06 by: Nudge
www.childao.com
1
1,341
thread by: eiji | last post Feb 14 '06 by: Victor Bazarov
Does that just not compile with vc++? I found this in "template complete" and asked myself if this is just a nice feature of some compilers, or if it is standard? I can't install other compilers! ########### #include <iostream> template <typename T> inline
4
1,593
thread by: gamehack | last post Feb 14 '06 by: Keith Thompson
Hi all, I've been designing a program which would need to have a function to replace values in a string. For example I could have a string: "<circle x="%" y="%">" and then I would replace the % with actual values. But I cannot think of a way to convert an integer(say 5643) to a NULL terminated string. I'm thinking of writing a function...
1
1,235
thread by: Ciko | last post Feb 14 '06 by: Default User
I had a look at this book: "C Primer Plus, Fifth Edition Stephen Prata " and I found simply fantastic. My english is little but I had no problem to understand it. Was wondering if you suggest to get a copy of it or if there is something of better than it.
3
2,669
thread by: Lars Grobe | last post Feb 14 '06 by: Michael Mair
Hi, first hello, I am new to the list, and I guess my question will show that clearly. I want to use some vector operations (at the moment altivec) in existing code. It is a raytracing-based application, and for now, I would like to replace the operations on my data type vect3 (which is a float array) by operations on a vector float. The...
2
388
thread by: myth.drannon | last post Feb 14 '06 by: Ian Collins
symbol 'FunctionFromA' referenced in file 'File_B.DOJ' could not be resolved I include the header with the missing function. What's more strange that another file containing exactly the same function calls and include files and being in the same directory compiled well. Any ideas guys ?
2
3,535
thread by: cedarson | last post Feb 14 '06 by: cedarson
I am writing a program and have been instructeed to use the 'fseek', 'ftell', and 'stat' functions, however, after looking in the online manual for each of these, I am still unsure on how to use them. In my program, I am to write a code that opens a file, uses 'stat' to determine the file size, use 'fseek' to move the offset of the pointer,...
14
1,434
thread by: subaruwrx88011 | last post Feb 14 '06 by: Default User
I am using a map that takes an string as the key and a structure that is being stored. struct StateType { int i; float f; char* s; }
31
6,190
thread by: t-tocs | last post Feb 14 '06 by: jesper
I need some help with the following C/C++ question. It is fairly straight forward but I'm having some difficulties. Thanks for your help. You are given the following function signature: void addParen(char* str) Write code for the function body that will enclose every
2
7,172
thread by: leo | last post Feb 14 '06 by: Julian V. Noble
I am looking for a source code for solving linear programming using simplex method. if any one of you have any code related to it in C,C++ or JAVA then please send it to me immediately.
3
1,652
thread by: lou zion | last post Feb 14 '06 by: Victor Bazarov
hi all, i'm trying to use a classes enums in another class, but can't seem to find the right syntax. i've got class A which has: enum EditTypeA {Currency, Percent, LabeledNumber, Text}; EditTypeA LineType; // LineType holds widget type, and will be either Currency, Percent, LabeledNumber or Text
2
1,875
thread by: utab | last post Feb 14 '06 by: Diego Martins
Suppose we wish to find the median of a collection of values. Assume that we have read some of the values so far, and that we have no idea how many values remain to be read. Prove that we cannot afford to discard any of the values that we have read. Hint: One proof strategy is to assume that we can discard a value, and then find values for the...
5
3,766
thread by: Piotr | last post Feb 14 '06 by: Daniel T.
Hi, I have the following code which uses STL transform algorithm. It basically takes a list of Rect* object, get all the y attribute and store it in a vector of 'int'. My question is: is there a way to simplify the code? Is there a way for me to get rid of the GetY class, since it essentially just calls 'getY()'. Thank you.
20
520
thread by: ramu | last post Feb 14 '06 by: Michael Wojcik
Hi, int main(void) { char ch='a'; printf("%s",ch); return 0; } Why does this give segmentation fault?

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.