473,545 Members | 319 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.
5
3,861
thread by: W. D. | last post Aug 7 '05 by: James Dennett
Hi, I am having a great deal of trouble trying to get ZeosLib (6.1.5 stable) to work with Borland C++ Builder 6. Since there weren't any C++ examples in the base package (http://sourceforge.net/projects/zeoslib/), I Googled for some examples and found these: http://www.baghli.com/bcb_mysql.html#examples
5
3,024
thread by: Vijai Kalyan | last post Aug 8 '05 by: Vijai Kalyan
Hello, I have come back to C++ after a couple of years with Java so I am quite rusty and this question may seem poor: My platform is Windows XP with MSVC 7.1. I have a class with a templatized conversion operator defined as follows:
5
5,502
thread by: Code4u | last post Aug 7 '05 by: Alf P. Steinbach
In the course of writing numerical code I needed to convert a float to an int with a defined behavior: if the float is great than INT_MAX, set the int to INT_MAX, otherwise assign directly. The problem I ran into is a float with value INT_MAX assigned to an int results in the value -2147483648 being assigned, but if the conversion takes place...
5
1,295
thread by: Steven T. Hatton | last post Sep 2 '05 by: Axter
I've run into a situation where the conventional thinking doesn't seem satisfactory. I have a table of data where each row maps into a struct. I want to put these into a vector. My overall design uses interfaces for everything accessed from outside of the namespace. I also have a class that acts as a wrapper for the structs. For example: ...
5
8,703
thread by: verec | last post Aug 15 '05 by: verec
I just do not understand this error. Am I misusing dynamic_cast ? What I want to do is to have a single template construct (with no optional argument) so that it works for whatever T I want to use it with. Now, if that T happens to be some subclass of a known base class (object, in this case), I want to perform some extra stuff ... I've...
5
1,566
thread by: Gordon | last post Aug 7 '05 by: Steven T. Hatton
Hi all, I've been told that Stroustrup's C++ book is a must read, but is subtle and advanced enough that much would be lost to me if I didn't know much of the language ahead of time. I'm already proficient at C, and know enough about C++ to use it as "C with classes". The thought of having to read about the language conditionals and...
5
4,466
thread by: zeroSpammingIsBadtype | last post Aug 16 '05 by: zeroNorShaltThouSpamtype
Hi, On Cygwin, most of the header files for gcc and g++ used UNIX style line breaks, so I've been replacing these (by copying into Wordpad from Notepad and then copying out again) with Windows-style line breaks. However, this doesn't get rid of instances of character 12 (Form Feed). Is there any reason why it wouldn't be safe to delete...
5
1,572
thread by: Dylan | last post Aug 9 '05 by: Joe Bacigalupa
Is there a string stream I can write into and read from? I've tried std::stringstream but it won't let me read from it. ie I can do this: int iData = 123 std::stringstream ss; ss << 123;
5
8,945
thread by: wallacej | last post Aug 10 '05 by: wallacej
Does anybody know why unsigned char myImage; works but unsigned char myImage; does not? I think its because the second line is a value too big for unsigned char, is this correct? If so:
5
1,910
thread by: Markus Dehmann | last post Aug 10 '05 by: Ben Pope
Profiling has shown that during runtime of my program, 100 million objects of class X are constructed and destructed. What is the best way to optimize in such a case, both for memory and speed (speed maybe more important)? One idea is to make the class very small, to contain only the most important member data, and put everything else,...
5
3,796
thread by: g18c | last post Aug 10 '05 by: g18c
I am trying to have a pointer to a member variable, however i will be deriving a number of classes from a base class. Whilst the code below works, i am wondering if there is a better way of doing this, or indeed if there are any traps i am missing. #include <iostream> class BaseClass { public:
5
1,425
thread by: Ben | last post Aug 10 '05 by: Ben
Hi all, I know what I need to do if data_ in the code below were a uchar*, but what about when it's an uchar array? Do I need to specify my own copy-constructor and assignment operator? #include <iostream>
5
22,831
thread by: hanzhou.zhang | last post Aug 11 '05 by: hanzhou.zhang
Hi, vector<int> v; //... int size = v.size(); Since the vector's size() function returns a "size_t" number, the compilation with /Wp64 reports some warning. My question is: If I can gurantee "size" is not a big number, will the conversion from "size_t" to "int" on 64-bit platforms cause error ?
5
4,074
thread by: gg | last post Aug 11 '05 by: msalters
I am getting the following compilation errors with the following program. My compiler is aCC 03.27 on HP-UX11 - #include <iostream> using namespace std; #include <list> #include <memory> #include <string>
5
3,831
thread by: alex | last post Aug 11 '05 by: shanemjtownsend
HI,all: I use ofstream of stl to manange a file, but how can I get size of the file? // open file std::ofstream * log = new std::ofstream( "test.log" ); // get size ???
5
1,932
thread by: Tony Johansson | last post Aug 11 '05 by: E. Robert Tisdale
Hello experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that sound strange. Here is the whole section: It says" Because inline functions are expanded at compile time, definitions of these functions, unlike other definitions cannot be separately compiled and must be
5
1,880
thread by: Tony Johansson | last post Aug 12 '05 by: msalters
Hello Experts! I know that to use heap-based objects, the C++ programmer has to define variables that are of pointer types like Car *car = new Car; Now to my question I also read this "to use heap-based objects, the C++ programmer has to define variables that are of either pointer or reference types." Is it really possible to use...
5
1,501
thread by: snorkelman | last post Aug 12 '05 by: snorkelman
I'm having a compile time problem with g++ 3.2.something, which I can boil down to this: struct A { template<int N> void foo(){} }; template<class T> void fn( int & ) { A a;
5
1,352
thread by: Pradyut | last post Aug 12 '05 by: Srini
on running this program on some linux versions, it does not compile bcc test.cpp --------------------------------------- #include <iostream.h> using namespace std; int main() { std::cout <<"test"; return 0;
5
3,517
thread by: imranzafar | last post Aug 12 '05 by: Default User
Hi! I am a beginner in C++. This is little assignment. It gives an error "Structure Require on Left Side of dot operator" Can anybody help me what went wrong in this code? #include <conio.h> #include <stdio.h> #include <iostream.h> void set(void); void display(void);
5
2,159
thread by: john | last post Aug 12 '05 by: Victor Bazarov
By doing: void MyClass::MyFunction() { static int myvar; .... } We can defined a function local variable 'myvar' that keeps its value from call to call (the point is that the variable can not be easily
5
1,565
thread by: Mogens Heller Jensen | last post Aug 14 '05 by: Mogens Heller Jensen
Hi group, I wonder - can anybody tell me if it is safe to make a union like this: union Event { unsigned char charData; struct { unsigned int channel : 4; unsigned int type : 4;
5
1,362
thread by: opistobranchia | last post Aug 15 '05 by: Earl Purple
I know this gets asked all the time but..... I am a fresh grad. I have taken a year of java and 1/2 year of C++ and OO Design and Analysis. I have strong Java skills and I have done projects in c++. But I am pretty sure that I am getting this job as a java/C++ software engineer. I want to put out a good impression since it is with a real...
5
1,974
thread by: Geoff Cox | last post Aug 15 '05 by: Mirek Fidler
Hello Would be grateful if someone can make a few things clear for me! I have developed a small app using Java and would like to do the same using C++ but without the need for a runtime environment addition. This is a very samm app and it seems foolish to have to ask the user to install 20 MB of extra software. The app displays an...
5
1,500
thread by: Baloff | last post Aug 15 '05 by: benben
Hello I am learning C++, a book exercise is asking to write a C program for the purpose of learning compilation output when compile with c or c++ compiler. the program must use puts() without <stdio.h>. is this a valid C program? #include <iostream.h> int main(){

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.