AllExperts > C++ 
Search      
C++
Volunteer
Answers to thousands of questions
 Home · More C++ Questions · Question Library  · Free Encyclopedia ·
More C++ Answers
Question Library

Ask a question about C++
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
About Ralph McArdell
(Top Expert on this page)

Expertise
I am a software developer with more than 10 years C++ experience and over 20 years experience developing a wide variety of applications for Windows NT/2000/XP, UNIX, Linux and other platforms. I can help with basic to advanced C++, C (although I do not write just-C much if at all these days so maybe ask in the C section about purely C matters), software development and many platform specific and system development problems.

Experience
My career started in the mid 1980s working as a batch process operator for the now defunct Inner London Education Authority, working on Prime mini computers. I then moved into the role of Programmer / Analyst, also on the Primes, then into technical support and finally into the micro computing section, using a variety of 16 and 8 bit machines. Following the demise of the ILEA I worked for a small company, now gone, called Hodos. I worked on a part task train simulator using C and the Intel DVI (Digital Video Interactive) - the hardware based predecessor to Indeo. Other projects included a CGI based train simulator (different goals to the first), and various other projects in C and Visual Basic (er, version 1 that is). When Hodos went into receivership I went freelance and finally managed to start working in C++. I initially had contracts working on train simulators (surprise) and multimedia - I worked on many of the Dorling Kindersley CD-ROM titles and wrote the screensaver games for the Wallace and Gromit Cracking Animator CD. My more recent contracts have been more traditionally IT based, working predominately in C++ on MS Windows NT, 2000. XP, Linux and UN*X. These projects have had wide ranging additional skill sets including system analysis and design, databases and SQL in various guises, C#, client server and remoting, cross porting applications between platforms and various client development processes. I have an interest in the development of the C++ core language and libraries and try to keep up with at least some of the papers on the ISO C++ Standard Committee site at http://www.open-std.org/jtc1/sc22/wg21/.

   

You are here:  Experts > Computing/Technology > C/C++ > C++

Questions Answered By Expert  Ralph McArdell 
In Category  C++

SubjectDate Asked

usb input/output in c and c++ is there any way?11/22/2009
  Q: sir, this is venkatesh and i am an engineering computer student.i like to know if there is any way ...
  A: The answer is yes - probably. It depends on what sort of system you are using. Most modern desktop / ...
Searching and Sorting Array Problem11/15/2009
  Q: My name is Ernest. I am trying to teach myself C++. I am currently working on a C++ problem that I ...
  A: [Note: I am not going to show too much C++ code here as I am sure you notice I do not write code for ...
what is the difference between this two?11/13/2009
  Q: please, here is a working code that displays the binary bit pattern, byte by byte using a union. ...
  A: The answer is almost certainly due to a fundamental difference between union types and struct or ...
c++11/10/2009
  Q: Q.Please can you tell me how to build my own library?also how can I include different functions in ...
  A: First thanks for mentioning the compiler you are using. 1/ Building a library: ...
C++ program10/8/2009
  Q: I want to make a simple program to ask a user two questions ex: what is your name? What is the ...
  A: As this looks like it may be homework or coursework I am going to show you part of the solution and ...
How to prevent a method in superclass to be overridden/overloaded in subclasses10/6/2009
  Q: I am trying to implement Template method pattern in C++. I want to have a method in superclass as ...
  A: OK, on to your current question. First a question to you regarding the code you actually posted ...
How to prevent a method in superclass to be overridden/overloaded in subclasses10/4/2009
  Q: I am trying to implement Template method pattern in C++. I want to have a method in superclass as ...
  A: I notice this is a duplicate of a question posted to me under a different name. The only difference ...
How to prevent a method in superclass to be overridden/overloaded in subclasses10/3/2009
  Q: I am trying to implement Template method pattern in C++. I want to have a method in superclass as ...
  A: I notice this is a duplicate of a question posted to me under a different name. The only difference ...
question9/20/2009
  Q: Can we use the same function name for a member function of a class and an outside function in the ...
  A: Yes and I am surprised you cannot think of an example as you asked the question you must have some ...
prime numbers code problem8/31/2009
  Q: my programme is suppost to print in the screen all the prime numbers smaller than the one i enter in ...
  A: Well, because you have made a mistake some where - errm , obviously! The task then is to find what ...
STL8/30/2009
  Q: i can't understand the code: std::sort(theList.begin(), theList.end(), compare); the compare ...
  A: The std::sort algorithm works with random access iterators - so if theList is an actual linked list ...
heap8/29/2009
  Q: im a BS-information technology student.i have a problem with my assignment.can u please explain to ...
  A: A heap can be one of two things: - a data structure - another name for the free ...
URL check8/23/2009
  Q: How are you? I'm trying to write a program that, among other things, needs to validate a website. ...
  A: First you need to decide what you mean by "web site exists". Would you need to validate the form ...
C++ newbie6/27/2009
  Q: Hey, I just wrote a simple program that went very wrong, can you take a look and tell me why the ...
  A: Well to answer the first part we have to look at what your program does. New lines are _only_ ...
enumuration values6/12/2009
  Q: could you plz tell me that are enumuration values coerced to integer?or are any other types coerced ...
  A: Short answers are: Maybe and no, although coerce is probably not the correct term here. Longer ...
VIRTUAL Constructor & destructor5/15/2009
  Q: can you please explain abt Virtual constructor and Virtual Destructors in C++.
  A: Yes. First C++ does not directly support such thing as a virtual constructor - more on this below. ...
Output Help4/20/2009
  Q: I wrote this code and it needs to output to the screen as well as a file. Well I can get it to do ...
  A: OK the most obvious and easiest way to do this it to literally write all data twice - once to one ...
Complex exponents in C++4/15/2009
  Q: I am currently writing a program that calculates velocity of a rocket. one of the equations calls ...
  A: Well other than the fact that if x*t were negative then -x*t would be positive, I presume you mean ...
friend function3/26/2009
  Q: Can we make the main function a friend function?
  A: Yes. There appears to be no restriction on doing so listed in the ISO C++ standard. It also worked ...
set of values3/23/2009
  Q: Yes, I am asking on how to detect the highest and lowest frequency values from a set of values. ...
  A: Now I can help <g>! However I think if you had sat down and thought it through you would have been ...
convert pointer to int3/19/2009
  Q: Could you please tell me how to convert a pointer to an integer. I am overloading delete and i want ...
  A: First the standard blurb about avoiding doing such things: In general you should not need to do ...
fstream3/18/2009
  Q: this is a simple code i used to delete autorun.inf file that mostly used by virus n replace it ...
  A: -------------------------------------------------------------------------------------------------- ...
constructor overloading3/16/2009
  Q: what is the difference between constructor overloading and function overloading?
  A: Primarily function overloading applies to functions (including class member functions) and ...
Displaying results in metres and cm3/15/2009
  Q: I want to output the display answer of a conversion program to show meters, centimeters and ...
  A: So this is not so much about C++ or any other programming language and more about the nature of ...
string concetenate3/14/2009
  Q: sir, i am working in v.c++6.0.sir tell me what procedure i adopt to concetenate the all private data ...
  A: The C++ library facility for this sort of thing is the IOStreams library. We can stream the members ...
compiler errors3/13/2009
  Q: I've encountered errors in my program. here's some parts of the codes.. //definitions in ...
  A: [Note: Code shown in this answer is for demonstration and exposition purposes only. It is _not_ ...
unidentified error..3/7/2009
  Q: I've encountered errors in my program. here's some parts of the codes.. //definitions in ...
  A: -------------------------------------------------------------------- See end for added follow up ...
Writing free software for many users2/18/2009
  Q: I would like to write a few useful freeware programs, including a database application creator. ...
  A: Assuming you intend to re-write your code in C++ (why else would you be asking a C++ expert?), then ...
timed macros2/13/2009
  Q: I'm doing a program for my engineering class where I need to ask a series of questions every 5 ...
  A: Firstly I would like to say that your use of the term "macros" has me a little confused and worried ...
Header Files2/4/2009
  Q: In order to use particular functions we must include a header file. However in the header file all ...
  A: No, the compiler does not contain the code for printf that you would call from you're own program. ...
c++ coding to control all hardware12/15/2008
  Q: coming to my question directly- can i give any beep sound to my audio out put(speakers, not the one ...
  A: I presume that you mean via your audio hardware - sound card or integrated audio on the motherboard. ...
hey.12/14/2008
  Q: I'm trying to make a program if a user inputs male,m,f, MALE, female, maLE, mAle, feMAle and all ...
  A: I have no idea what you have done wrong in the code you are actually executing because the code you ...
C++ socket programming12/5/2008
  Q: Is there any classes specific to C++ for handling sockets??...are sockets used for inter process ...
  A: Umm, sorry what? I do not understand what you mean. A (current) ISO standard hosted C++ ...
C++ socket programming12/4/2008
  Q: Is there any classes specific to C++ for handling sockets??...are sockets used for inter process ...
  A: Is there any classes specific to C++ for handling sockets?? ...
Loading dll with classes in DEV-C++11/30/2008
  Q: I want to compile an algorithm in C++ provided by Microsoft that uses a windows dll (system.dll). ...
  A: In short no you cannot with DevC++ / MinGW C++. I strongly suggest you learn what is and is not ...
Physics11/29/2008
  Q: Can you please explain me in brief, how can I access the parallel port in XP with C++ as a ...
  A: That depends on what exactly you mean by parallel port. If you mean the (now legacy) parallel ...
i/o file streams11/18/2008
  Q: My program needs to read in a series of data points from an input file, then generate an output file ...
  A: I suspect your problem is that you are probably looking at this is too small chunks. Look at the ...
Putting all templates in header file11/16/2008
  Q: I need to know if it is a good idea to put everything in the header file when working with ...
  A: I would like to address your last request first. Asking for a prompt reply is not going to get you ...
help plz11/7/2008
  Q: i wrote a simple code for ackerman function but it cant work when 'n' or 'm' is greater than 3 can ...
  A: Sorry but I do not have the time to reverse engineer, debug and possibly fix your code. You should ...
storing a sentence in a string variable11/1/2008
  Q: im using dev c++ and i wanted to know how i can store a whole sentence to a string variable. thanks
  A: Sorry but your question is not very clear as to what exactly you are trying to achieve. I present ...
Question in C++ using for! HELP10/28/2008
  Q: The Question is Write a program that output the numbers 0 to 8 in three columns, where the width of ...
  A: Firstly, in general using pre or post increment or decrement (++x, x++, --x, x--) in (complex) ...
help plz10/23/2008
  Q: can you help me about this program,it doesn't workwhen n is mor than 30 what should i do for solving ...
  A: You have not appreciated the fact that numbers - either integer or floating point - held by ...
using template in c++10/16/2008
  Q: i am just a beginner in c++ . when i use the following code it says that template cannot be used in ...
  A: Yes you can use templates (as instantiated specialisations of those templates) in main but you have ...
c++ set10/13/2008
  Q: i wanna insert in ma set datastructure 2 values.<char mac[],int p>.but i am not able to do it.since ...
  A: Well, other than some rather odd design decisions (e.g. p is never initialised in constructors, ...
enlarge the integer space10/12/2008
  Q: or how can i compute a vey big integer like this for example ...
  A: There is no way to use unlimited space for an integer representation within a digital computer. The ...
From where should i start?10/7/2008
  Q: Sir! I am Kiran studying in Master of Engg.(Info. Tech)-2nd year. I am working on the project ...
  A: At the beginning - which for software projects is doing things like requirements capture, ...
input float values from a file9/23/2008
  Q: sir, i am creating a program in which i need to read in a text file of floating point values given ...
  A: You state that only the values of the 6th and 7th items of the 10 or 12 on each line are of interest ...
Add a minimize button to my dialog box9/20/2008
  Q: I'd like to add a minimize button to the title bar of my dialog box program. I've looked through ...
  A: This is not a C++ programming issue per say. It is a MS Windows programming question. The reason ...
cpp doubt9/8/2008
  Q: What is the difference between the strcpy and memcpy
  A: Well this is more of a C question than a C++ question. As an aside note that cpp does not ...
Arrays in MSVC++69/5/2008
  Q: My MFC dialog box program has multiple edit boxes and I would like to make an array of the edit ...
  A: OK, in the lines: CEdit* pTrcLen = (CEdit*)GetDlgItem(pArray[0]); and ...
Arrays in MSVC++69/4/2008
  Q: My MFC dialog box program has multiple edit boxes and I would like to make an array of the edit ...
  A: Sorry, my mistake. There was indeed an error in my code snippets, probably because I did not look ...
Arrays in MSVC++69/3/2008
  Q: My MFC dialog box program has multiple edit boxes and I would like to make an array of the edit ...
  A: There is nothing wrong with your basic idea - just the fact that this is _not_ the syntax to use. ...
error message9/2/2008
  Q: Ralph do you know the meaning of the following error message?? error: expected unqualified-id ...
  A: Sorry but without seeing a minimal example that produces the problem I cannot say for sure - human ...
Classes & Members8/29/2008
  Q: Is there a way to have one class include another class? Say you have class_A, class_B and class_C, ...
  A: Almost certainly. It depends on what exactly you mean by the term "have one class include another" ...
override keyword with virtual functions8/27/2008
  Q: I got lots of libraries in native C++ for MS VisualStudio and want to compile them with g++ on a ...
  A: Yes. Mostly. override is part of C++/CLI - the C++ extensions for use with the Common Language ...
validating numeric only8/26/2008
  Q: Is there any alternative way to validate an input whether it is numeric or not? I tried to use ...
  A: Yes. Many. ...
Thousand Separator8/23/2008
  Q: i've searched through the internet, and found a few of information on how to properly format a ...
  A: I note that you have tried converting the value using a standard C library function that of course ...
Memory management in C++8/21/2008
  Q: Sir, I have following questions in C++ 1.What is Stack and heap ? What is the use (2 separate) of ...
  A: 1.What is Stack and heap ? What is the use (2 separate) of it? ...
using c++ to use parallel or serial port7/25/2008
  Q: sir, how can we use c++/c to use parallel and serial ports?? are there any special classes defined ...
  A: The answer depends on what operating system (if any) you are using. You will often find parallel ...
Dynamic object creation7/21/2008
  Q: Can you tell me a way how to create an object if the class is passed as a string dynamically? The ...
  A: The short answer is that you cannot do this directly in C++. C++ is a statically typed and compiled ...
C6/16/2008
  Q: I am using fedora core 3 for development.For one of the project we got the source code library(SCL) ...
  A: I cannot say exactly what you need to do as you give no details as to what sort of symbols are ...
loop6/15/2008
  Q: i am doing a program to average grades that is ended by a sentinal. how do i remove an unwanted ...
  A: Note that as this is almost certainly homework or an assignment of some sort I am not going to show ...
c++6/8/2008
  Q: Is it any way to prevent changing of number? In c++ I get answer of 2999 / 10 = 299.899994. But it ...
  A: This is not so much a C++ problem as it is a problem with floating point representation and ...
overloading6/4/2008
  Q: We can overload assignment operator as a normal function.But we can not overload assignment operator ...
  A: Ummm, to me the term 'normal function' tends more towards meaning a non-member function rather than ...
lValue required6/1/2008
  Q: What is lValue? Some of my C++ programs flag an error: "lValue required". Any help will be greatly ...
  A: The short answer is that an lvalue is something that can appear on the left hand side of an ...
random long long in C/C++5/28/2008
  Q: I am trying to generate a uniformly distributed pseudo-random number of 12 digits. The problem is ...
  A: If you are asking is there an ISO standard C++ library function to produce such a value then, ...
Native C++ XML5/27/2008
  Q: I'm trying to develop a class that needs to store some informations about paths to some data. I was ...
  A: You seem to be asking at least two separate questions: how to represent your data in memory using ...
Regarding String Manipulation5/22/2008
  Q: How to copy characters after the last occurence of delimeter from a string. Eg:think am having the ...
  A: How about some logic like so (in pseudo code): delimiter : constant character = '/' ...
c++5/20/2008
  Q: There are lot of disadvantages of macro, than why we use it?
  A: Indeed. In fact you should not use macros in C++ unless you have no other choice as C++ has features ...
C++ programming5/7/2008
  Q: Sir, I am new to this prog. My prog contains statements as given below: #define COM1 0#define ...
  A: Well the sort of thing you show is common in C programs. C++ has alternatives that reduce the need ...
C++ source code -> assembly language (CPU instruction set) -> binary code5/6/2008
  Q: My understanding of processing a C++ program as follows: ------------------------------------------- ...
  A: Yes I do and you are wrong. A CPU does _not_ execute assembly language. It executes machine ...
jobs with c++5/3/2008
  Q: i just have a question related to jobs in computer science, not c++ itself i have decided to ask u ...
  A: Take any piece of software - an application, an add on, an operating system, a device driver. Each ...
deleting multidimensional array pointers4/25/2008
  Q: if i created a pointer to an array i would go like this int *array = new int[size]; and when ...
  A: Your question is ambiguous. Do you mean an array of pointers used like a multi dimensional array or ...
linked lists4/23/2008
  Q: how can i destroy an entire linked list? assuming that i have a linked list "head" if i go like ...
  A: Starting with your last points, as these are most fundamental. Setting a pointer to a null pointer ...
ofstream and setf3/31/2008
  Q: i have the following question for you i want to change the flags of a ofstream variable for example ...
  A: That is because there is not. Or possibly there is not. The std::ios_base::setf functions take ...
local sensitive formatting3/26/2008
  Q: I'm having trouble with advice you sent me concerning local sensitive formatting. There was no ...
  A: OK in your code std::cout is a stream and oss is a stream. You have imbued the std::cout stream with ...
c++ filehandling3/25/2008
  Q: I want to initialise int value .but it gives error when i initialise it within class in public or ...
  A: First it is difficult to understand exactly what you are doing wrong without seeing exactly what it ...
#ifndef preprocessor3/24/2008
  Q: Mr McArdell I have the following question I've been trying to use the #ifndef, #define and #endif ...
  A: The technique you refer to is called include guards. In fact to be specific it is internal include ...
Problem upgrading to MS VC++8 Express Edition3/20/2008
  Q: As per your suggestion, I've upgraded from VC++6 and downloaded MS VisualC++8, but have a problem. ...
  A: Firstly if you are the Neil who asked about localising displayed number formats then as far as I can ...
European decimal-comma national setting3/14/2008
  Q: I've completed a program in MSVC++6 but have a problem in that it will only function in the American ...
  A: I think what you are asking and what your example implies are somewhat different. 1/ What you ...
C++ vectors (incrementing an element)3/13/2008
  Q: after i read each character from an input stream (a text file) one by one how do I count the ...
  A: I am not sure why you say you are stumped as you have the basic idea totally correct! The only ...
C++ test score drop question2/28/2008
  Q: I'm trying to write a program where the user inputs 5 scores and has to find the lowest score. It ...
  A: First I would like to say how nice it is that someone who has obviously been set some coursework ...
Rate question - Hz2/27/2008
  Q: I have a line of code that says if(g100Hzframectr%100==0){... which is defined in the comment as ...
  A: Yes and no. I cannot state what the intention of the code is as I do not have enough information, ...
Char and int2/23/2008
  Q: I wonder if theres possible to add a int variable to a char string. For example: int x=5; char ...
  A: Yes there is. But it is not done quite how you show. However you are very nearly there: you are ...
C++ : Reading commands from a txt file2/6/2008
  Q: I am implementing a simple data structure in c++ (a stack). The problem is that I want my program to ...
  A: The short answer is no. The slightly longer answer is yes, but you have implement interpreting the ...
c++ strings2/1/2008
  Q: i want to enter string in mine program 1st method is : main() { char h[44]; cout<<"enter your name ...
  A: Yes. Quite a few in fact. However, if we restrict ourselves to using C++ standard library features, ...
c++1/24/2008
  Q: how to ompare 2 conditions using an OR operator in c++ in linux environment.when i press the OR ...
  A: I would suggest that the root of your problem is that the keyboard layout setting you are using with ...
c++ faq1/23/2008
  Q: why the size of empty structure in C++ is 1 byte and in C its zero?
  A: Are you sure this is correct for C? The C99 standard states in section 6.2.6.1 (Representation of ...
Help1/16/2008
  Q: I mean it, which i wrote in my question because i asked same questions to others but i got answ that ...
  A: First off, which version of Turbo C++ (I presume this is what you meant by TC++) are you using? The ...
problem in c++ programming1/16/2008
  Q: and thanks for your help about my last prob. U was on vacation and i was waiting for u because only ...
  A: I had in fact realised you were using a C++ compiler of some description û you fail to mention which ...
Reference (C++)1/16/2008
  Q: I have 4 seemingly similar questions about reference: 1. Can you return a reference to public data ...
  A: The word in all these questions that we should focus on here is 'can'. C++ does not prevent you ...
problem in c++ programming1/15/2008
  Q: and thanks for your help about my last prob. U was on vacation and i was waiting for u because only ...
  A: Firstly, I very much doubt I am the only one to be able to answer such questions as you ask here. ...
A question on strcmp's implementation1/12/2008
  Q: Below is the code snippet of Microsoft's C runtime strcmp implementation: int __cdecl strcmp ( ...
  A: -------------------------- FOLLOWUP -------------------------- One thing I should caution you about ...
File processing12/17/2007
  Q: Ralph McArdell I am reading a text file in c++. There are 13 columns in a row and 3370 lines. I ...
  A: Sorry but you have almost all of the code I used. The only parts missing are: - the header ...
C++12/17/2007
  Q: How can we implement f(x)=10 in c++;
  A: Sorry but I am not sure I understand your question. Do you want a function f that takes a ...
File processing12/16/2007
  Q: Ralph McArdell I am reading a text file in c++. There are 13 columns in a row and 3370 lines. I ...
  A: This is a rather odd piece of code. For a start what are all these supposed calls to the stream ...
c++12/12/2007
  Q: i dont know where and how to use static_cast<int>( ) forexample:num-static_cast<int>(num) plz help ...
  A: Well you really should not need to use static_cast<int>() for built in type conversions and ...
About file handling in C++12/2/2007
  Q: Kindly requested that can you tell me How to sort the 100 records in the file in C++
  A: Not definitively. This is because they are many ways one could approach this problem. The exact ...
Constructors of Global Object12/1/2007
  Q: I have a lot of experience with C++ but I never understood one thing: If you define a global object ...
  A: This behaviour is defined in the ISO C++ standard in section "3.6.2 Initialisation of non-local ...
variables12/1/2007
  Q: i have just begun to delve into programming. i am currently reading an excellent beginners book, ...
  A: In programming languages like C++ variables are things that can hold a variety of values, and the ...
void POINTER11/30/2007
  Q: . Can you explen me about void pointers in C++ in detail with example.
  A: In C and C++ a void pointer, or void * type, is a pointer type that points to no particular type of ...
Opengl C++ in Linux - Animation/evolve not working11/28/2007
  Q: I am very new to C++/opengl and I have been having alot of trouble with my C++ code for the Linux ...
  A: I am not an expert in OpenGL but it seems to me from a quick look at your code that you have two ...
Void functions and the switch operation (logic errors)11/27/2007
  Q: Hey Ralph, Hope you're doing well. I wanted to ask you something pertaining to a C++ code I'd ...
  A: You do not get the file to do anything – it is a chunk of data. Rather you read the data in the ...
Void functions and the switch operation (logic errors)11/27/2007
  Q: Hey Ralph, Hope you're doing well. I wanted to ask you something pertaining to a C++ code I'd ...
  A: Well a quick look at the code reveals that you are reading in a char then using it like an int: ...
fstream as a class member11/26/2007
  Q: Would you give an example code how to write a copy constructor or assignement operator for a class ...
  A: The problem is that std::fstream objects are _not_ designed to be copied. In fact copying and ...
seting position of cursor on desired location at the screen in c++11/25/2007
  Q: Aoa.i am a student and i have to do ana assignment in which i have to set the postion of cursor on ...
  A: The C and C++ language standards have _no_ support for such functions. You do not mention what ...
Is it possible to inherit classes from STL classes?11/24/2007
  Q: Sir; Is it possible to inherit a class form an STL class. Is there any memory issue if we r using ...
  A: The answer is yes and no. Yes you can inherit from an STL class (including the basic_string class ...
C++ compiler porblem11/21/2007
  Q: I have developed a project using C++ with many different .cpp files (main.cpp,window.cpp,courses.cpp ...
  A: First I think config.sys has very little meaning in the world of Windows XP. Second I am unfamiliar ...
C++ constructors and float vs double11/21/2007
  Q: Good day, I have two different questions regarding C++. First, I wanted to know what are the main ...
  A: 1/ Constructors --------------- The first form: myclass() { n = 0; } is in ...
Mapping in C++10/22/2007
  Q: I've got a difficult question and I hope you know an answer or at least where to have a look at. ...
  A: Your question seemed a bit garbled - several bits were repeated at random points in the questions as ...
I/O10/19/2007
  Q: after executing the following code ifstream infile; ... while(!infile.eof()){ //read each ...
  A: I suggest you try: infile.seekg(0, std::ios::beg); I am assuming ISO standard C++ IOStreams ...
C++: Deques and sets10/17/2007
  Q: It takes longer to remove a randomly selected element from a deque of given size than it takes to ...
  A: I cannot comment too authoritatively on such things as I am not an expert in the design and ...
Compile cpp file without void main10/13/2007
  Q: ! How to compile cpp files without void main(). And after successful compilation how to link all ...
  A: Only one C++ implementation (.cpp) file requires a main (assuming you wish to build a standard ...
question of c++10/12/2007
  Q: 1.Why constructor don't return their address? 2.Why we always define constructor in public domain? ...
  A: 1/ Why should they? Constructors initialise an object. The object already has a memory location. ...
Pointers in C++10/9/2007
  Q: #include<iostream.h> #include<conio.h> #include<string> #include<stdlib.h> #include<malloc.h> ...
  A: Sorry but no you are not doing the correct thing. 1/ Header files: ---------------- ...
Using function, result is incorrect10/5/2007
  Q: I am very new to C++. We're on our 9th day, and learning Functions. I am listing the problem, and ...
  A: You have missed one very important point about functions: The code they contain is not executed ...
files10/5/2007
  Q: How are you doing? I'd like to ask you a question if you have a bit of time. How do you use C (or ...
  A: I am a little confused as to why you are asking me (as a C++ expert) primarily about C! However in ...
adding a string to a char array10/3/2007
  Q: I've searched the net and posted this question to a forum, but still haven't got a usefull solution. ...
  A: OK. First off char arrays are the C-style way of handling strings. A C-string is an array characters ...
Macro Expension10/3/2007
  Q: i am trying to debug an application that has used complex macros. can u suggest me a way to look at ...
  A: Yes I can. In fact I had to do just the same thing recently. Look at the options for your compiler. ...
C++9/27/2007
  Q: Is it possible to deallocate the memory of a null pointer?
  A: This depends on what you mean by de-allocate the memory of a null pointer. If you mean can you ...
C/C++ needs header files9/25/2007
  Q: I try to understand why C/C++ needs header files, but Java doesn't. Do you know about this by any ...
  A: I have a bit of knowledge, yes, although I am in no way a Java expert so lack some of the finer ...
strtok function of string.h9/19/2007
  Q: we have to use NULL as a first argument in strtok function after first call. but second call onwards ...
  A: You do not. You have to ensure strtok is working on one and _only_ one token string at a time. This ...
Game Of Life Algorithm9/16/2007
  Q: I'm working on a program that implements the game of life algorithm. I am to print a two dimensional ...
  A: Have you tried to use this random function you are asking about? If so you will soon find it is in ...
c++9/15/2007
  Q: write a programe in c++ to find the reverse contents of an array using "for"loop. array size is 3.
  A: Sorry but can you please try this yourself and then ask a question if you have some specific ...
Delete duplicate elements in vector9/14/2007
  Q: vector<string> str; I have the vector filled with strings "a", "b", "c", "b", "c", "d", "a". i.e ...
  A: Answer: ------- First I think your example line: str[0] = a; str[1] = b; str[2] = c;.....and ...
how to prevent overriding of some functions in derived class9/11/2007
  Q: Ralph, I am trying to write a system of classes, in which I have one particular functionality in ...
  A: In short you cannot. Once you declare a member function is virtual any sub-class can override it - ...
Regarding vector of vectors9/10/2007
  Q: Please look at the following code: dependencies(int i) { string str; vector<string> fd; ...
  A: I suggest you start by revising the behaviour of local automatic objects (variables) in C++. What ...
Linked Lists9/9/2007
  Q: I was working on a Linked lists program, and these errors come up that I cannot work out. I have a ...
  A: Ok this is the line where you made the (reasonable) mistake: List grocery(); You might think ...
File Handling in C++9/5/2007
  Q: It's a file handling program in C++. while executing the program below I got the last number printed ...
  A: First, why are you using pre-standard and non-standard headers? The standard C++ header is ...
c++8/31/2007
  Q: que is:- what is access modifiers?
  A: This is not a term used in C++. C++ tends to use access specifier instead. However I will assume ...
signed vs unsigned char ?8/31/2007
  Q: As when I compile: ----------- #include <iostream> using namespace std; int main() { char ch1 ...
  A: First the character you chose from the Windows character map is obviously not the same as that with ...
increment/decrement8/28/2007
  Q: sir, if x=3 x-=--x-x-- how answer is 1 plz tel me steps and if i m writing like x=x---x-x-- it is ...
  A: You are modifying x in both cases more than once in an expression. This is _not_ allowed and is ...
I/O text file8/27/2007
  Q: I wont to add some extra information (text or int) to an existence text file with out deleting the ...
  A: You do not say how you are currently trying to open you files. However as you are asking a C++ ...
c++ operator overloading8/26/2007
  Q: . i want to know how the operator over loading functions are invoked..for example how s1+s1(both ...
  A: I do not know if you really intended to say: s1+s1 in your question, but maybe instead meant: ...
How to use type discrimination?8/26/2007
  Q: I was going thru your answer for following question, ...
  A: Ah! Well I was only speculating in my answer and had not thought out any specific scheme for the ...
finding size of a file and delete8/24/2007
  Q: I am doing program in CPP... in that I have to find size of the file. Suppose size of the file is ...
  A: ------------------- FOLLOWUP ------------------- I have read your ratings message and note that you ...
virtual functions8/9/2007
  Q: sir the basic concept of virtual functions in c++ is that it will see to it that it wll not allow ...
  A: I think you may be confusing virtual functions with virtual inheritance. I also think that by values ...
C++ & VC++8/3/2007
  Q: What is difference between Virtual functions in C++ and Message Mapping in VC++
  A: Virtual functions are part of the C++ language that provides C++ users with the object-oriented ...
Pre & post increment8/1/2007
  Q: Sir, Read the question below. #include<iostream.h> #include<conio.h> void main() { int a,add; ...
  A: Because what you are doing is illegal! You are modifying the value of a more than once in the ...
C++ passing variables7/26/2007
  Q: void main(void) { int r; int b; sub(1,r,b); //r will = 0 and not 2 like it is supposed ...
  A: Depends on the variant of BASIC. If you are using a newer variant such as Visual Basic then you ...
retrieving month, say and year separately7/23/2007
  Q: I hope you are doing well. My question is about retrieving day, month, year separately. I will be ...
  A: ---------------------------------------------------- FOLOWUP ...
class7/23/2007
  Q: sir is there any way by which we can compare two classes and perform the operation such as comparing ...
  A: The short answer is no, you cannot compare classes. However I do not think you meant to ask about ...
Visual C++ or C++?7/22/2007
  Q: Ok, this question has probably been asked several times but I'll ask it again because everyone ...
  A: Basically yes. Although you will have to check the feature matrix for the current version of Visual ...
Visual C++ or C++?7/21/2007
  Q: Ok, this question has probably been asked several times but I'll ask it again because everyone ...
  A: OK, let me clear up some terminology. C++ is a computer programming language. It is free to anyone ...
int x = a+++b;7/18/2007
  Q: I've tried the following code snippet, why was the value of x 12 ? but not 13? #include <iostream> ...
  A: Well although a++ is evaluated first because post-increment has a higher precedence than add the ...
C++ address starting point7/17/2007
  Q: C++ pointer must be integer, and it is a memory address of an object. I want to know where a C++ ...
  A: They do not count them from anywhere specifically as standard. What memory addresses are available ...
Memory de-allocation7/16/2007
  Q: I'm trying to allocate a 2 dimensional array of pointers dynamically. I do this in my "Landscape" ...
  A: There are two forms of new and delete - scalar and array. When deleting the individual cells of your ...
allocators in std7/11/2007
  Q: I usually work on basic libraries cross-platform compiled and useful for many things. Recently I ...
  A: All the standard library containers allow the specification of an allocator type to be used to ...
file handling in C++7/10/2007
  Q: I have made a generic template class for 1D array.This array can be any type of inbuilt data ...
  A: You do not say what format you wish to save the data as so I shall assume usual C++ practice and ...
opening excel and creating a graph with c++7/9/2007
  Q: I have a text file with a list of values that I would like to display as a graph using a simple ...
  A: I am sorry but I am confused. Your question’s subject: "opening excel and creating a graph with ...
How to apped data at enf of text file7/8/2007
  Q: I have a question. I know how to read text files using ifstream. Now I would like to append some ...
  A: That basically depends on exactly what you wish to do. If you have only opened the file and read ...
What is RTTI?7/4/2007
  Q: sir; please explain me Run time type identification. Also explain me exact difference between Debug ...
  A: The term used in C++ tends to be Run Time Type Information. C++ is a statically typed language. ...
Please help me with vectors7/3/2007
  Q: I am new to using vectors in C++. I have initialized 2 vectors "Rel" and "Wed" Now, both the vectors ...
  A: Yes. Do not use ++pos or pos++ - that is do not move forward from the beginning at all. Thus: ...
Please help me with vectors7/3/2007
  Q: I am new to using vectors in C++. I have initialized 2 vectors "Rel" and "Wed" Now, both the vectors ...
  A: If you are the same Rahul that asked the question about string literals a day or so ago then I am ...
Regarding files7/2/2007
  Q: In my program i have a string variable "FilePath". I later on assigned it as follows: FilePath= ...
  A: Firstly this has nothing much to do with files - as you probably realised once you had finished ...
Virtual Function6/29/2007
  Q: #include <iostream> #include <complex> using namespace std; class Base { public: virtual void ...
  A: In the code you showed in your question no member function produces output "in float" so it is not ...
Linking6/28/2007
  Q: I am modifying an already working game which contains hundreds of source and header files. In ...
  A: There are two similar terms used in C and C++ (and probably many other programming language ...
fstream variable as data member for both read and write in c++6/1/2007
  Q: can I use fstream variable as data member of a class for both read and write in c++. i.e class ...
  A: In a constructor you initialise data members and base classes using a constructor initialiser: ...
Database in C++ w/ Little Experience5/22/2007
  Q: I have a little experience in C++ (I've taken the beginning course in the language offered at my ...
  A: When writing programs that communicate and control with Excel or other applications, you will need ...
Get time in milliseconds in Windows5/21/2007
  Q: I need to calculate time differences (in Win2k) in milli or microseconds. I tried GetSystemTime(), ...
  A: Well, I have not looked into these areas for a while but a quick peek at the MSDN library ...
creating 2D array dynamically5/15/2007
  Q: Ralph! Is it possible to have a dynamic 2D array in C++? I am going to apply this in the ...
  A: In short no; you can only create scalar objects and vectors (one dimensional arrays) of objects ...
C++ Operator Overloading5/6/2007
  Q: Good morning, I am playing with C++ and am wanting to overload the insertion operator << for a ...
  A: First I must apologise for the delay in replying to your question. I went out shortly before you ...
difference between turbo c++ and Unix c++5/6/2007
  Q: I am graduate in Mathematics.I have learnt programming in Turbo C++. I was wondering whether there ...
  A: Firstly I would like to point out that there are differences in programming in Turbo C++ and Turbo ...
Storing Info in Files5/1/2007
  Q: Hey Ralph, hope all is well... I plan to take official C++ classes in July this year. Seeing as it ...
  A: Well it is because of the previous input request for the number of students. You read it using: ...
Floating no comparison4/26/2007
  Q: main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); ...
  A: The problem is that you are not comparing like with like. You are comparing a lemon with a ...
Uhhh...4/24/2007
  Q: Hey Ralph, Here's my problem, I am writing a menu and one of the choices is to allow the user to ...
  A: I am not sure what you mean by cstring - do you mean a C style zero terminated character array ...
array4/20/2007
  Q: int i[10]; i[10]=1; lly char ch[10]; ch[10]='c'; Are these assignment statements valid? I am ...
  A: No, these assignments are _not_ valid. You are _not_ putting values in the last array slots, you ...
Array of user defined length4/20/2007
  Q: Ralph; Our C++ teacher has taught us that one cannot create an array of user defined length.So most ...
  A: ------------------------------------------------- NOTE: ...
Converting char to const char?4/18/2007
  Q: Is there any possible way to change a char to a const char? Okay. The problem is that I have a char ...
  A: Did you try to use strlen with your pointer to non-const char? If you had you would have found that ...
About function prototype4/5/2007
  Q: what does operator void * () mean? where and how it can be used?
  A: OK let's break it down: void * is a type, a pointer to an unspecified type. operator is a keyword ...
Undefined reference when linking.4/2/2007
  Q: I am new in the C++ world, and I have problems to solve a "undefined reference to class::method" ...
  A: Without knowing exactly what you are doing - what files you are compiling, which you are linking I ...
Tweaking my source code4/2/2007
  Q: Hey Ralph! Its me again, I asked you a question yesterday and your feedback was by far the best ...
  A: Might I suggest that before rushing in and using language features you have not used before like ...
Where's my logic gone wrong?4/1/2007
  Q: Hey Ralph, hope all is good, First off I'd like to introduce myself to you. I'm 26, residing in ...
  A: No, I'll help you. Even if you were a student and this is homework you have at least got some code ...
using an array for brute combinatorics/permutations3/31/2007
  Q: ok i dabble with programming a bit, and recently it occurred to me that digital audio has a very ...
  A: OK, I am still not 100% certain I have understood exactly what you are trying to do and what you are ...
using an array for brute combinatorics/permutations3/31/2007
  Q: ok i dabble with programming a bit, and recently it occurred to me that digital audio has a very ...
  A: Well the first point that I can make is that you might like to upgrade to a newer or alternative ...
c++3/30/2007
  Q: i wud like to kno if i can store an operator in a variable eg:x=+ and later use this operator for ...
  A: In short no. (note: you could have determined this by just trying it - the compiler would have ...
C++ on Variable Creation3/29/2007
  Q: if(false) { static int a; } Will the variable "a" created or not ?
  A: Maybe, and if not then not necessarily for the reasons you might think! Strictly speaking the ...
Tabular Columns3/27/2007
  Q: I am student in high school learning c++.I would like to know if we can include tables in the form ...
  A: The simple answer is no, you cannot. There is no direct support in standard C++ for any particular ...
Is there such thing as 'virtual class' or 'abstract function' ?3/23/2007
  Q: Is there such thing as 'virtual class' or 'abstract function' ? Thanks,
  A: Hmm, out there in the universe in general there quite possibly are such concepts. However with ...
C++3/16/2007
  Q: can use realloc to extend a memory allocated with new?and if not why?
  A: No. The realloc function is part of the C dynamic memory handling functions and goes with malloc, ...
what must it do to make validation to the input here3/16/2007
  Q: I hope you're good I want to ask in a problem faced me when i was coding a simple calculator ant ...
  A: You are reading the values as doubles. If you enter a double value in a format that is not supported ...
Software used for C++ programming3/15/2007
  Q: I am a novice to c++ programming. Currently I use "Turbo C" to practice programming.But I always get ...
  A: What I received is that you are using "Turbo C" not "Turbo C++" (Turbo C plus plus). This implies ...
C++3/12/2007
  Q: how do you define an array without providing a size declarator?
  A: In short you do not. However it can be left off for the first dimension if you provide array ...
Linking "ifstream ins" to file "booklist2.txt"3/12/2007
  Q: I am having trouble linking the compiler to an outer file in order to load the data from the outer ...
  A: FOLLOWUP: --------------------------------------------------------------------------------- It ...
C Nestled Classes3/6/2007
  Q: Hey, I was wondering if it is possible, in any way, to create nestled C classes. I'm probably ...
  A: First yes it is possible to have nested (not nestled) classes. Second, yes you are using the term ...
check status without reading from input stream3/5/2007
  Q: I am writing some code in the scenario which can be described as follow: + program A which writes to ...
  A: Your problem is that C++ streams and streambufs are synchronous, that is they block until done. If ...
Bit Operators3/2/2007
  Q: How can you tell whether the binary number of a character is odd or even. I not sure I understand ...
  A: First you need to understand what you are being asked to do. From your description of the question ...
Large Multidemensional Arrays2/26/2007
  Q: I would like to create a large two-dimensional array of doubles, but every time i create one that is ...
  A: There is no problem with doing this in theory other than if you define such a large local automatic ...
Doesnt a static object need to be destroyed when it a member of a class and the class is destroyed2/20/2007
  Q: Aloha, Some history: Was told that my destructor for a class was causing problems. I destroyed a ...
  A: You seem to have two points of confusion. The first is to confuse a class with the objects (or ...
problem of random character2/20/2007
  Q: I am a beginner and I want to generate a name of five random characters from 'a' to 'z'. How can i ...
  A: In many ways. You say you are a beginner but not exactly what you have learnt already. Please note ...
Loop2/15/2007
  Q: I wrote this code which tries to get the user to input 2 positive single digit numbers then the next ...
  A: Well I only had a quick look but it seems to me that your implementation of the algorithm is ...
Can we make a constructor virtual?2/9/2007
  Q: Can we make a constructor virtual? Thanks, lzzzz
  A: So if you could how would this work? The polymorphic behaviour that virtual member functions allow ...
Functions of the basic structure of a program2/8/2007
  Q: When do we use int main() and void main in a program? Why does a C++ program use "using namespace ...
  A: 1/ The ISO C++ standard states that main may have one of two forms: int main() { /* ... ...
Learning C++ for ME2/6/2007
  Q: Mr. McArdell, My name is Jeanette Akerson, and I decided to learn C++ on my own, just because I ...
  A: However as you state what specific help you require to just set you on your way I would probably ...
How to differentiate integer and alphabets1/29/2007
  Q: I have previously asked a question on how to differentiate integers and alphabets when reading from ...
  A: In fact you have all the information you require in my answer to your previous question. I assume ...
How to differentiate integers and alphabets when reading .txt file using C1/26/2007
  Q: I have only learnt C and not introduced to c++ codes at all. Can you help in advising how to ...
  A: First because you are asking a C++ expert I will make it clear that I have not written pure C code ...
strtok in c++1/24/2007
  Q: I have used strtok to tokenise a textfile to extract words by removing ."'. But I am not able to put ...
  A: I am not surprised. Although you carefully use an array of 10 * 100 characters for the storing of ...
Building boost libraries for 64-bit windows targets1/9/2007
  Q: You mentioned in your answer to another question that you have configured the boost libraries to ...
  A: In theory yes. However I remember the process was painful - especially as this was my first time ...
classes12/14/2006
  Q: I was also wondering how to write a peek function for a queue, that will return the string at the ...
  A: Assuming you are using the C++ standard library, which is likely judging from your previous ...
classes12/14/2006
  Q: i was wondering how to derive a class from a vector. any suggestions?
  A: Yes. In short don’t. The C++ standard library containers are _not_ designed to be derived from. ...
variable name and function name not known till run time12/6/2006
  Q: Is it possible with C++ to have my variables stored in a file , then at run time I initialize ...
  A: The short answer is no. The longer answer is yes, but not directly. You have to provide the code to ...
Parallel Port12/5/2006
  Q: I need to get the output from an A to D converter inputted into a computer using a parallel port. I ...
  A: The answer depends on what you mean by a parallel port and what operating system (if any) you are ...
C++ syntax question12/1/2006
  Q: I have a generally question. Logically, whats the difference between these two statements and whats ...
  A: The first statement declares and defines an object of type Culs::logCreator called logdata ...
Visual C error11/30/2006
  Q: . I'm working with visual c since a short period specailly with windows programming and I'm ...
  A: Possibly. I cannot say for sure but can give some general advice and make a more specific guess at ...
Store Vectors to a file11/23/2006
  Q: How do I store vectors in a file? Lets say I've 3 vectors dummy1, dummy2, and dummy3. ...
  A: I do not know for sure why std::vector (and the C++ standard library container types) does not have ...
c++ question11/22/2006
  Q: how to find number of objects present in a file,if the file contains a collection of items/objects ...
  A: That really depends on the structure of the file. Here are some obvious ways you could achieve ...
C/C++ dynamic linking ?11/17/2006
  Q: I noticed some C/C++ applications need to go through compile, link process when we install them in a ...
  A: In fact ISO standard C++ has _no_ support for dynamic linking. This is an operating environment ...
a wizard data type11/17/2006
  Q: .. I'm wondering if there a data type like that: // Data_Yype x; int y=5,a; cin>>a; if (a==1) ...
  A: In a word no. The types involved in the first case are different for a start, and the latter case is ...
virtual descructor11/14/2006
  Q: Suppose you have a C++ base class and several classes that inherit from it. What might happen if you ...
  A: The quick answer is that instances of derived types can be improperly destroyed if they are deleted ...
C++11/11/2006
  Q: ..ammm how can i improve my self in C++ and to understand it and to be strong on it... thanks in ...
  A: Like many things practice helps a lot. Think of some programs you would like to write, find out how ...
random function11/8/2006
  Q: Help!!!... I need to make a random function for a dice which I will be using in a game I am ...
  A: I am an expert in C++ not in the mathematics of random number generation. Taking that into account ...
cast a super array type to a sub array type ?11/1/2006
  Q: Can we cast a super array type to a sub array type ? the super array stores super class objects, ...
  A: First apologies for taking a bit to get back to you. I have been away for a little longer that ...
How to declare array of istream10/29/2006
  Q: I want to open an array of input file-streams (ifstream) pointing to the same file. I tried using ...
  A: My first reaction is that there seems little point in what you are doing. All the instances of the ...
Finding the primes10/27/2006
  Q: This program is supposed to prompt the user for where they want their prime finding to start and ...
  A: Your program has not locked up. It is running. Continuously. In short: num4 is dependent only on ...
C++ template10/24/2006
  Q: I'm trying to do something like: template <typename T, template <typename X ,typename = ...
  A: In template definitions the compiler cannot tell for sure which names are types and which are not if ...
fseek()10/24/2006
  Q: I can't understand what msdn says about fseek(). How would i use it to move a file pointer from the ...
  A: First a few points. I do not know if you intended it but you are asking this of a C++ expert not a ...
C++ inter-program communication10/23/2006
  Q: For reason's not important to this question, i need to have one c++ program, access a variable that ...
  A: As far as C++ is concerned the short answer is that you do not. The longer answer is that it ...
transient and Serialization10/18/2006
  Q: Is there Serialization in C++? In java, there is Serialization, and the keword word "transient" is ...
  A: You could answer this yourself by just trying it! You would find that transient is _not_ a keyword ...
file handling10/17/2006
  Q: how to read line by line from a text file and differentiate between charecter data and integer data ...
  A: First I am going to point out that _all_ data in a _text_ file is _character data_. Some sequences ...
Writing to file using C over Linux10/15/2006
  Q: McArdell I am working on Linux Fedora core 3 with gcc compiler, I want to write to a file in the ...
  A: I am sorry but you might have noticed that I am an expert in the C++ section not the C section. This ...
C program10/14/2006
  Q: sir can u say me how to write a simple C program to find the square root a no thanxxxxxxxxx
  A: First you do realise you asking a C++ expert about C programming don't you? In this case however ...
File operation10/14/2006
  Q: i am new to C++ and need your help in this code. i am trying to copy a text file in an array of ...
  A: I suggest you go back and read the small print for the std:istream::getline functions, here are the ...
C++ help10/13/2006
  Q: i have a input text file with a phase in it and i am trying to change the word 'be' to the word ...
  A: I am going to assume this is some sort of homework, coursework, course assignment or course project ...
inserting bitset into set10/12/2006
  Q: I am writing code which uses a set of bitset<4>'s. Constructing the bitset works fine, but I get ...
  A: The C++ standard library associative collection types, such as std::set and std::map, are sorted ...
How to make a function return a constant int10/10/2006
  Q: I'd like to construct a set of bitsets (using C++ STL), where the length iof the bitsets is ...
  A: You cannot use std::bitset in this way, just as you could not use size for the dimension of a ...
File I/O10/8/2006
  Q: Here's the thing: I want to use the random number function to give 2 random numbers, between 1 and ...
  A: First I would suggest you use srand to seed the random number generator used by rand to produce ...
bout reverse text10/6/2006
  Q: ok....i juz wanna ask u bout how to reverse the character,...dats all....ASAP.
  A: I am sorry but your question makes no sense as it stands. You cannot reverse a character, unless you ...
Memory leak10/4/2006
  Q: What is memory leakage in OOPS concept and what is the best way to cutdown it??? Thanks
  A: I do not think memory leaks are restricted to OOP. They are not confined to OOP, any style of ...
functions10/3/2006
  Q: sir, please explain how can we use the inbuilt function system()in c++ i am having a turbo c++ ...
  A: The system function takes a single C-style string parameter (i.e. a zero terminated array of ...
String Manipulation9/28/2006
  Q: I am a beginner with C++ and any help would be appreciated. The problem is i cannot cin properly the ...
  A: Well for a start this code does not compile with VC++ 2005 for 3 reasons: The line: char ""; ...
changing the name of a text file .9/27/2006
  Q: my problem now , i want to open many existd text files in my code and those file may have the ...
  A: First I shall point out that the subject line is misleading. Changing the name of a text file sounds ...
about header files in c/c++9/24/2006
  Q: How can I define user defined header file?
  A: First write the source code you require in the header file and store it in some project related ...
pseudocode for evaluating polynomials9/22/2006
  Q: I have this homework on evaluating a polyomial in its general form. For example, if you are given ...
  A: Strictly speaking this is not a C++ question. However I can see the sort of things you are doing ...
Increment operators9/20/2006
  Q: Why preincrement operator is faster than postincrement?
  A: For the build in integer types it may well not be (and, as with the rest of this subject, the same ...
C++ functions9/19/2006
  Q: Is function overriding and virtual functions same? If not, what is the difference?
  A: This is like asking if eating and food are the same. They are related. In the same way that food is ...
Function overriding9/18/2006
  Q: Sir, How can i impliment the following. I want to call an overrided function of the base class ...
  A: First I should point out that the example code you show is not C++ as I know it. The keyword class, ...
STRING MAINPULATION9/17/2006
  Q: If you are reading strings of varying lengths from lines of a program with a # delineator, how do ...
  A: First I think you are confusing 'program' with 'data read by the program'. The example you show ...
Function overriding9/15/2006
  Q: Sir, How can i impliment the following. I want to call an overrided function of the base class ...
  A: I shall try but I am not at all sure what it is you are trying to do. There three things I can ...
For loop for devc++9/14/2006
  Q: using namespace std; int test_1, test_2, test_3, test_4; double average = 0; double total_grade = 0; ...
  A: First I am wondering why you are using global variables rather than local variables. In a small ...
reading specific range in text files9/13/2006
  Q: Sir, i am trying to read a specific range in text files ( lets say the number in the line 20 and ...
  A: This seems like a reasonable thing to do and I have come across such requirements in real life. ...
C++9/12/2006
  Q: I m really satisfied with the answer. I have one more doubt.... In which cases Abstract base classes ...
  A: The obvious answer is when designing interfaces. Unlike other newer languages such as Java and C#, ...
c++9/11/2006
  Q: Can you please tell me What is difference between virtual base class and abstract base class ...
  A: An abstract base class (ABC) is any class that has at least 1 pure virtual function, meaning the ...
problem in c++ file handling9/10/2006
  Q: Sir, The coding u mentioned didn't seem to run. When I compiled the program, the compiler was ...
  A: My answers always assume standard C++ unless I know for certain the particular short comings of the ...
problem in c++ file handling9/9/2006
  Q: I'am trying to write a program that can find the file size of any file stored in the computer. I ...
  A: Well I would suggest you check out your C++ IOStream reference! The obvious problem is: ...
min of 4 values9/8/2006
  Q: I posed this question to Eddie actually and he replied but I still needed feedback and he couldn't ...
  A: Well the problem you both have is using else at all. In an if {...} else if {...} else if {...} else ...
read wav file and write its HEX values into a file9/8/2006
  Q: Yes, I'd like to write a program to read a wav file (the audio file) then output into 2 files the ...
  A: If you are asking how do you know where in the input file the header and data parts are then as I ...
writing a struct of variable size in a file9/6/2006
  Q: i have a question. In my program im trying to write a struct of variable size into a file for random ...
  A: I am surprised that you have not twigged the problem here. You are trying to use random access using ...
read wav file and write its HEX values into a file9/6/2006
  Q: I am a beginer with Visual C++. I'd like to write a script in Visual C++ to read a small (10 seconds ...
  A: First let us sort out some terms. A script is usually a term reserved for something that automates ...
Getline9/4/2006
  Q: I'm just learning C++ so this is probably one of the most basic questions You will ever get: Here is ...
  A: The reason is that the previous read from cin into the zipcode string extracted all characters from ...
C9/4/2006
  Q: I need to workout on a text file. This is the format Parameters Left[y] Right[n] ...
  A: First let me point out that your subject seems to be C, and you are asking a C++ expert. Which ...
c/c++ Overloading problem8/30/2006
  Q: i am stuck on a Alocated_variable_mem_stack class. see source here: ...
  A: [note: I have not got the time to read through your full code so have only looked at what you posted ...
You passed judgement too early8/28/2006
  Q: Mr. Mcardell, I previously wrote you about a small program. I did not want you to do the program for ...
  A: Sorry you feel that way. However my response was to your question, which read: " Subject: C++ ...
Advanced File IO in C / Unix Environment8/28/2006
  Q: I saw a previous post of yours in which you posted a very helpful link ...
  A: As I stated in the answer you refer to in your question this is not a C++ question but a UNIX/Linux ...
C write to /dev/8/3/2006
  Q: I'm writing a C++ program to control an SSC (servo controller) through the serial bus on Linux. The ...
  A: Might I first suggest you re-read the man page for write and check the returned value and handle ...
Initialization order in c8/2/2006
  Q: Could you please tell that why the constructor the of base is called first? Is there any technical ...
  A: Consider: "Why do we construct the base of a skyscraper first? Is there a technical reason or is it ...
C array7/31/2006
  Q: I am writing a program to read a file containing student names and scores for 3 exams. First of all ...
  A: Well you can now define arrays and open a file associated with a file stream and check that it is ...
Unable to read from a file created7/30/2006
  Q: I am in the process of creating a c++ program for vocabulary. The program will have five(5) options ...
  A: I am an expert not a clairvoyant and although seeing your code would help I really am not that ...
Bank account7/30/2006
  Q: I was working on this program C++ call bank account. The program should have 3 user inputs. Account ...
  A: First I going to state upfront that I am not going to write any code or develop your program too ...
Splitting a char7/29/2006
  Q: I am a noob in C and can't get a simple thing working. Background: I am writing a WinSock client. ...
  A: Please note that I am primarily a C++ expert and you are asking your C question in the C++ section. ...
volatile modifiers7/25/2006
  Q: i have read the concept of volatile modifiers from net. but the image of volatile modifiers is not ...
  A: What is the volatile modifier? --------------------------------- The volatile modifier is like the ...
return value7/25/2006
  Q: scanf() returns the no of fields successfully assigned values.and if we are assigining to sone ...
  A: If I understand what you are asking, you wish to know what happens to function return values (such ...
One dimensional arrays7/24/2006
  Q: I finally got the code to work properly, except for where to put my error and warning statement. 1) ...
  A: You should check directly after you have read the value in from the user. You need to test the state ...
objects/structure7/23/2006
  Q: i would like to know why there is a need for classes? because as i have tried we can declare public ...
  A: You are correct in a way. In fact it is probably better to loose struct than class as class is a ...
One dimensional arrays7/23/2006
  Q: I have made the changes you recommended but I am still having issues....This program is supposed to ...
  A: I had grasped this. Your main problem is that you have not made all the changes I suggested. I am ...
Copy Constructor for inherited class7/23/2006
  Q: I need to know if my copy constructor for class Hand is correct, and what to do next in the class ...
  A: I am not best pleased to receive such question. The code you post is incomplete (classes Hand and ...
One dimensional arrays7/22/2006
  Q: I am studying arrays at the moment(find it a bit tricky). This program is to prompt the user to ...
  A: So say you are studying arrays and you have worked out that you have done something wrong defining ...
operator overloading7/21/2006
  Q: 1.how can i come to know which operator take a name not a value? 2. what is the difference between ...
  A: Well, as there are only 6 operators listed that you cannot overload it seems not to difficult a task ...
C headers7/21/2006
  Q: What are the C++ headers and its uses and functions?
  A: Your question is ambiguous. I am not sure if you are asking about header files in general or the C++ ...
operator overloading7/20/2006
  Q: why just four operators cant be overloaded in c++ sizeof() ?: :: .* is there any special reason ...
  A: In fact the list is as follows: :: . .* ?: sizeof typeid The reasons are ones of practicality and ...
Dual Control Problem7/19/2006
  Q: For my class project, i have made a program. But now I realise that i have to run 2 functions, at ...
  A: This is an interesting and complex question so I am going to have to give you an overview and let ...
c7/19/2006
  Q: class FloatFileParameters { public: explicit FloatFileParameters( char const * ...
  A: Please read the rest of the answer from which this class (a type not a program) was an example. If ...
Triangle types C programming question7/18/2006
  Q: This program is supposed to prompt the user for three lengths which make up a triangle and print the ...
  A: Note: there is a 10000 CHARACTER limit on answers. The more questions are embedded in your single ...
c7/17/2006
  Q: Ok now i am telling you details. I am tring to make a wavelet data compression program and for that ...
  A: OK, so it is your program and you wish to add support for reading from a data file. You still did ...
Checking for Duplicates7/14/2006
  Q: I have a program that loads file names and their respectives paths into memory on a per directory ...
  A: As far as I know there is no faster way if the collection is unsorted. Also, even if the collection ...
member init.7/13/2006
  Q: if we have a class like: class AAA { int val; int arr[ 3 ]; public: AAA() : val(0) ...
  A: Unfortunately not. We do not have the correct syntax to allow this to happen as members initialised ...
Sorting and searching data7/11/2006
  Q: How can I sort data in alphebatical order after writng them(some records containing information ...
  A: This is a very large topic so I'll only give you a few pointers here. First, the techniques used ...
casting a colorDialog result to a string7/11/2006
  Q: Sorry for the noob question last time, but im a noob so i have noob questions.. This question is ...
  A: The compiler cannot cast integers to strings, this is not allowed. Mostly inbuilt casting allows ...
about strings7/8/2006
  Q: i used strrchr() to test the ff funtions bool isDigit(char ch) /*test if ch is a digit , returns ...
  A: They are already part of the C (and therby also the C++) standard library. Include ctype.h (C) or ...
GetMousePos7/7/2006
  Q: I was using the following code: #include <iostream> #include <windows.h> using namespace std; ...
  A: Well if you read what the error says and look at what you actually wrote and not what you thought ...
Exploding a string into an array6/27/2006
  Q: Okay, so I want to explode a given string into an array like PHP does. So I want something like ...
  A: There are several ways to do this. The most obvious is to leverage the facilities of the C++ ...
Strings6/26/2006
  Q: I understand how to write a single word into a string variable i also understand how to write a ...
  A: You concatenate each line to the end of the string. You will probably have to also append a newline ...
Calling pivate class members functions6/19/2006
  Q: I am using GNU complier, nice one. I am using g/+/+ 4.0 or something, i.e recent. Thanks, this ...
  A: First I have to say that your examples are not valid C++ - I expect you shortened them for the ...
How to read a text file in c which contains variable6/15/2006
  Q: I am trying to make a code that can read a text file . Because this file has some float numbers ...
  A: There are many ways to do this but the basic idea is to read the values from the file into one or ...
problem with pointer and string constant6/14/2006
  Q: main(){ char *ptr="hello world"; char arr[]="hello world"; *(ptr+1)='x';//it does not work ...
  A: Note: you are asking this in a C++ section so I am answering assuming you are writing C++. If you ...
undefined reference6/14/2006
  Q: What exactly is a "undefined reference" error? Reason: I have created a class called GridPDF. it ...
  A: As error messages differ between tools, and you do not say what compiler and linker you are using I ...
Listing Files in a folder6/7/2006
  Q: I want to know, how can I list down the files in a folder in C++ (NOT MFC). I am making a client ...
  A: First I am sorry for not getting back to you sooner. I have been unexpectedly away from home for a ...
Multiplication Table6/7/2006
  Q: I have been trying to figure out why my program won't run. It seems to be hanging up on the Array ...
  A: First sorry for not getting back to you sooner. I have been unexpectedly away from home for a few ...
fstream6/5/2006
  Q: My question now is about fstream. I was trying to do some binary file reading. I wanted to declare ...
  A: Yes you can. But you have to close the previous file _before_ opening another otherwise the open ...
STL Iterator6/5/2006
  Q: I have wrote my own Multiset Container and Iterator class. My Iterator class have a pointer point to ...
  A: It would have saved me a good few minutes (half hour maybe) if you had said straight out what ...
How does it display ???6/4/2006
  Q: I have a problem in my homework ! I don't know how it display on screen .Can you help me please !. ...
  A: First of all I would appreciate it if you could be bothered to post code that is laid out in a ...
Using the STL6/1/2006
  Q: I'm trying to reteach myself classes and ran into a funny problem (although I don't think it's ...
  A: First off the STL sort, like all C++ library names, is in the namespace std i.e. it is properly ...
Global Objects Creation Priority5/30/2006
  Q: I have two objects defined in global namespace: ICString glb_ProgBuildDate(SOME_AUTOCONF_MACRO); ...
  A: OK. There is _no_ way to order the initialisation of global objects (i.e. non-local static objects). ...
constructor overloading5/30/2006
  Q: what is constructor overloding?whats its need?what is the method of constructor overloding?what r ...
  A: OK, although a constructor for a class is a special member function it is still considered a ...
Character manipulation question in C++5/30/2006
  Q: I am a college student taking a introduction class to C++ language. I am not going to ask you to do ...
  A: OK the first thing to say is: Don't panic! (in large friendly letters...) The second ...
C++ Searching algorithm5/26/2006
  Q: I have a file with many rows and coloumns.Suppose the first column is A,then how do i find out ...
  A: Your basic approach is to treat the file as an array. For the problem as stated it is relatively ...
Help on a basic level: resource files5/23/2006
  Q: Me and my programming teacher in high school is trying to learn more about .rc files, and how to ...
  A: First I must point out that this is _not_ a C++ question. It is a question about how to use a ...
Wow.. Thankyou so much,...5/22/2006
  Q: Wow.. Thankyou so much, that clarified a lot. So, Microsoft Visual CPP is harder to use than ...
  A: First let me explain what ISO standard C++ is. It is a document published in 1998. It does not ...
message box5/21/2006
  Q: Hey Ralph, I'm 16, trying to move from Visual Basic 6.0 to Visual C 6.0. I've just made an empty ...
  A: Bits removed as new 5K char. answer limit. AllExperts replace Cplusplus with C . You’re right ...
User data entry problem5/19/2006
  Q: First of all, thank you very much for your prompt reply. I tried your recommendations, and as you ...
  A: Sorry, but as I said in my original answer I do not have Dev-C++ so do not know how they integrate ...
trouble using string class in dev c++5/18/2006
  Q: i am a student from india learning c++ using the booodshed dev c++ environment. i have some trouble ...
  A: First this sort of usage does not do what you expect: 0<=s.find("a")<=s.length() It does ...
User data entry problem5/17/2006
  Q: McArdell, I've been having this problem for a while, on all of my programs. For example, here is ...
  A: I have run your program on Windows XP x64 and SuSE Linux 10.0 x64, built using the MS Visual C++ ...
String class pointer5/12/2006
  Q: What i'm trying to do is find a way to use the getline() function to read from a file in an open ...
  A: From what you state in your question you appear to be doing the correct thing. std::istream::getline ...
tutorials4/4/2006
  Q: I'm quite a beginner at C++ and I wondered where I could find some EASY TO UNDERSTAND C++ tutorials ...
  A: Sorry but I cannot recommend any online tutorials for C++. As an expert and starting my long and ...
filling up of a frame with 10bit words3/27/2006
  Q: consider a frame of 720 words each word is of 10 bits how can i fill up my frame of 720 words with ...
  A: In this case, no I do not think std::bitarray will be of much use as it cannot output the data in ...
C++ and FORTRAN communication?3/20/2006
  Q: I have a computer program written in FORTRAN which outputs very small or very large numbers using ...
  A: I should check your code if it is crashing. I suspect this is because your stream state is getting ...
Pointers3/19/2006
  Q: *) Can u please let me know, How to find address of class or any non-abstract data type ? *) ...
  A: 1/ Types do not have addresses. Objects (instances of types) have addresses. To find the address of ...
c++3/17/2006
  Q: where can you download c++?
  A: This simple question is not as easy as you think. The most accurate answer I can provide is: From ...
writing in a file3/17/2006
  Q: I am converting a integer number into binary number and storing it in following array char ...
  A: You seem not to have not grasped the fact that when your value is an integer is _is_ a binary value ...
Is the NULL a value in C/C++ ?3/14/2006
  Q: So can I just return zero instead of NULL for the same purpose? Thanks, lzzzzHi, Is the NULL a ...
  A: Yes. Assuming that your purpose is to return a pointer and that pointer has a null pointer value. ...
C3/13/2006
  Q: My name is D.Prince. While studying C,I came across the word 'precision,double precision..'. ...
  A: 'Precision' is not just a C/C++ term. It is used in many areas some of which are computer languages. ...
Is the NULL a value in C/C++ ?3/13/2006
  Q: Is the NULL a value in C/C++ since the following return statment is not correct? I thought it was ...
  A: Yes. Although strictly speaking we can use 0, as 0 (an integer value) is convertible to a null ...
about bitset3/6/2006
  Q: first of all thank you for answering my prevoius questions and helping me i would like to know 1) ...
  A: 1/ bitset is the name of the header file you have to include to use std::bitset. bitset.h is nothing ...
error C2678(c++)3/5/2006
  Q: Through search engine online, I found your response for the question about error c2228. I managed ...
  A: First let me clarify errors. C2678 is _not_ a C++ error - the C++ standard stipulates where an ...
Beginner programmer needs help3/5/2006
  Q: I am just starting out with C++ programming and trying to teach myself through internet tutorials ...
  A: Nothing. The program runs, outputs "Hello World" or whatever to the console window then completes ...
use of bitset c++ URGENT3/3/2006
  Q: my question is 1)how can i use <bitset> to store 10bit data 2)how can a 10 bit data stored in ...
  A: 1/ Storing 10 bit data in a bitset Well the obvious way is to specify 10 as the number of bits in ...
Pulling information from a file3/2/2006
  Q: I am using the compiler Bloodshed Dev C++ and I am wondering how I would extract a line from a file ...
  A: Leaving the requirement to be used in an if statement (note: _all_ keywords in C and C++ are ...
binary number storage3/2/2006
  Q: how can i generate random binary numbers and store them in 1 byte form
  A: C++ uses the C library functions rand and srand and the macro RAND_MAX to support random number ...
Is there a superclass object created when creating a subclass object?2/16/2006
  Q: With the following snippet, how many objects of type A are created? I know for sure there is one in ...
  A: The short answer is: Yes. Remember a B is an A. In fact the A in the B at line #5 is referred to ...
pointer address and object address2/5/2006
  Q: I want to make sure I understand correctly. are the following four points correct? 1/ The line 7 ...
  A: Sounds about right to me (although you do not have lines 7 and 8 on separate lines in the code as it ...
exponents2/4/2006
  Q: I am trying to work with Dev-C++. Are there exponents in C++? How do I get 2 to the 5th power to ...
  A: C and C++ have no operator for computing x to the power y. It _does_ have operators to perform ...
pointer address and object address2/4/2006
  Q: With the following small program, I try to print the address of the pointer foo and the address of ...
  A: Well the foo object - a pointer to Foo type - is (notionally) created and destroyed each time around ...
doing division1/28/2006
  Q: i am trying to do a division program my daughter can use to learn to do division. i can get ...
  A: This is not so much a C++ question as far as I can tell, but a general point about the different ...
problem in copying1/27/2006
  Q: sir, i have recieved a mail containing a C++ program. i have copied to my notepad. as it is HUGE, ...
  A: Source code is nothing more than text - ASCII text at that, not UNICODE or anything fancy. Try ...
write/read same file in the same .cpp program1/14/2006
  Q: I am trying to create an output file from the user input. Then I'd like to use this output file as ...
  A: Well you have two main approaches to this, both will work with the C++ IO Streams file streams. ...
fstream1/1/2006
  Q: If I want to delete specified data in a saved file, without deleting the whole data in that file. ...
  A: This is not just a C++ problem. It is a problem in the way files and file streams in general work. ...
Downloading a file online.12/30/2005
  Q: I would like to know if it is possible to read a file into a stream to a file that is online using ...
  A: In short, no not like this. The file name you give is a URL and the first part of this specifies ...
call by referance keeps the...12/29/2005
  Q: call by referance keeps the last value of the variable (yes or no) when we use recursion we can ...
  A: This is _not_ a C++ question - it is a general programming question. Call by reference passes a ...
What kind of variables and functions should be public, or private?12/27/2005
  Q: Merry Christmas! What kind of variables and functions should be public, or private? Thanks, lzzzz
  A: Public interface member functions should be public. That is, the members functions that user's of ...
file permissions and C++12/25/2005
  Q: Ralph McArdell I have been using allexperts for quite a while now and by far you are the greatest ...
  A: This is not a C++ question. It is an operating system programming question. I assume you are using a ...
fstream12/24/2005
  Q: If I want to make a file to save my inputs in it, like what the user enters. How do I create this ...
  A: First, unless you are using a really old version of the C++ library - by which I mean pre- ANSI / ...
Why must variables be declared before it is used, but not methods?12/18/2005
  Q: Why must variables be declared before it is used, but not methods? Thanks for your help, lzzzz
  A: Wrong. In C++ functions and variables have to be declared before use. They need not be defined ...
which compiler to use11/25/2005
  Q: Due to disability I cannot work. Before medical retirement I worked as an IT Helpdesk Analyst. Now I ...
  A: Hmmm, well I should make it clear these are only my suggestions - others may well see things ...
It seems that we can not throw an exception at class level, is there any reason for that?11/19/2005
  Q: Sorry about the confusion. My short example as follows, use snippet2 instead of snippet1. ...
  A: I would think there is a good reason... It is executing code that causes exceptions to occur and ...
Classes11/18/2005
  Q: Can't I access the private data members by using pointer?
  A: Indeed you can. In fact you can make the required syntactic changes quite easily to my example that ...
Classes11/18/2005
  Q: How can I access the private data memebers of a class, other than using a function. And please give ...
  A: From where else would you want to access or refer to objects other than for declarations and ...
Bank Accounts Program11/6/2005
  Q: I'm having some difficulty completing a program for one of my CS Courses. I've written all the code ...
  A: OK. Well you could start by actually creating the three files as asked for in the question – you ...
CButtons11/4/2005
  Q: Im programming using visual c++, and have started a MFC project. I want to be able to run through a ...
  A: I suppose you have something like: for ( int i=0; i<numberOfButtons; ++i ) { ...
What is the internally difference if I read a data as bytes, characters, string and stream?10/19/2005
  Q: What is the internally difference if I read a data as bytes, characters, string and stream? Thanks, ...
  A: Depends what you mean and in what context. Also data is plural so you cannot read a data – it is a ...
Are ASCII and byte the same thing?10/18/2005
  Q: How are you? Are ASCII and byte the same thing? The reason I am asking this is because somebody ...
  A: Oh dear. I thought you would have got past this misunderstanding by now. No they are not. A byte ...
Triangles in C10/18/2005
  Q: good day, i was wondering if you could help me in programming. i'm trying out this program i found ...
  A: First a few points: You are asking this C question of a C++ expert. While I have of course written ...
c++10/15/2005
  Q: I am a new programmer in the c++ arena..can you suggest me good beginer books for this language. & ...
  A: C++ Books and C++ Information Resources: ---------------------------------------- There are many ...
listing a directory10/14/2005
  Q: using turbo c++ 3.0 os : xp proHow do i find the contents of the current folder in a c++ program? I ...
  A: The quick answer is that there is no standard C++ or C way to work with file system directories (or ...
fies10/8/2005
  Q: I was woundering if you could aid me in learning about files. before i write a program I need a ...
  A: First this question has very little if anything to do with C++ and programming, so is automatically ...
char* versus _TCHAR9/30/2005
  Q: Many thanks for your informative email. Very interesting, I promise to rate you well for your ...
  A: names is an array of four pointers to _TCHAR so you pass it as names. However you do have to get the ...
char* versus _TCHAR9/30/2005
  Q: Just wondering what is the difference between _TCHAR* and char*? I saw an array of names in a ...
  A: Yes you are wrong in your assumption. It has nothing to do with the text itself. It has to do with ...
avoiding premature eof termination9/24/2005
  Q: I am having a problem using "while (!File1.eof())" on a program i wrote which does text compression. ...
  A: From this I deduce you are using a Microsoft operating system. On MS operating systems - dating from ...
Invalid Handle Error while using WINAPI call GetModuleFileNameEx in c++8/31/2005
  Q: I am trying to write a program in c++ that gets the name of the EXE for an external process thats ...
  A: First I must apologise for not getting back to you sooner. I work away from home at the moment and ...
C++ Problem8/20/2005
  Q: I have one problem with porting a C++ application originally developed on IBM compiler on solaris ...
  A: In short your code will most likely compile with the header files in a suitable location - assuming ...
C++ delay a loop or funtion for paticular time delay8/20/2005
  Q: i need to delay my loop and execute it so how to do it in C++
  A: I am not sure I fully understand what you are asking so I shall say sorry now if I have ...
Since only one copy of each method is stored, what is the difference between static methods and normal methods?8/12/2005
  Q: Nice to see you again! my question is: Since only one copy of each method is stored, what is the ...
  A: I shall assume that by 'method' you mean 'member function' and shall ignore inline functions. There ...
pointers8/6/2005
  Q: i have the structure hostent (built in) struct hostent { char *h_name; char **h_aliases; int ...
  A: You do as is implied in your question - you keep looping through the h_aliases array until you reach ...
eval function from javascript in C++?7/29/2005
  Q: is there something like the eval function from javascript in C++? i remember dynamically creating ...
  A: In this respect C++ is fundamentally different from Javascript, Java, or the .NET languages. It is a ...
copying a function7/23/2005
  Q: plzz help. how a can i write a program to copy function (as a whole) from one c++ file to another ...
  A: This seems easy in concept, but is in fact quite when you sit down and consider all the details. ...
dll hooking7/8/2005
  Q: Just to let you know, I do not plan on doing anything bad. Now about my dll, it MUST have all the ...
  A: Yes. All the exported symbols that are used by the application that uses the original dll _must_ be ...
OOOPS!7/7/2005
  Q: i normally type in upper case because to me it looks neater. i don't mean to shout, but sometimes i ...
  A: Note that you can use upper case where grammar and usage dictate – such as at the start of a ...
BUILDIN EXE'S7/7/2005
  Q: I DON'T KNOW IF YOU WOULD KNOW BUT IF YOU DON'T KNOW, CAN YOU DIRECT ME TO SOMEONE WHO KNOWS.... I ...
  A: First, netiquette, please do not SHOUT! Use of all upper case is considered rude and like shouting. ...
books on c/c++6/11/2005
  Q: as the question subject suggests, i would like to know what are the best books for a beginner to ...
  A: There are many books on C++ but not many good ones for beginners. For those like yourself who ...
about c6/4/2005
  Q: i have the following questions: what are the main uses of the c/c++ programming language? what i ...
  A: C++ is used for many different application types. However managed development environments such as ...
C++5/22/2005
  Q: How can we create runtime object in c++? Explaination: we just have the class name and from that i ...
  A: I am going to assume you mean that at runtime there is some data external to the code in which you ...
RTF to PDF Convertor5/21/2005
  Q: McAdrell, I hope you are doing fine and well, i extend my best wishes for you. I am currently a ...
  A: Well, if it were me I would first try to find out if there were already some things I could use to ...
cookies involving mapping5/20/2005
  Q: This is actually my first time using map. is there a way that I can pass the map values through a ...
  A: First, you cannot mail me as you do not know my address - at least I hope you do not, and if you do ...
about !block.eof() and passing an arrayed varible through a function.5/20/2005
  Q: I chaged this to #include <sys/types.h> // UN*X like system header #include <dirent.h> // UN*X ...
  A: First could you please reduce the size of the posting – I had difficulty finding your new question ...
about !block.eof() and passing an arrayed varible through a function.5/6/2005
  Q: Question 1) I have the code: #include <fstream.h> #include <iostream.h> #include <math.h> ...
  A: Question 1: Well I am not 100% sure what is going on. Your question 1 code is a little flawed - if ...
Hello, It's been a while4/23/2005
  Q: i dunno if you remember who i am. lol. But as you know your my favorate, c++ master. Ok, i guess ...
  A: Now, as to your question. I am not sure what you wish to do with the file and directory information ...
Class4/17/2005
  Q: Given the following class definition class Tank { const float water_level; int ...
  A: My first thought here is could you please explain which part of the answer you did not understand? ...
about class access modifiers ?4/15/2005
  Q: The question you left me as follows, ---------------------------------- You might also wish to ...
  A: Yes. That's what I rely on – static member functions for example have access to private and ...
C++/OpenGL Help4/9/2005
  Q: Im a begginer in c++ and opengl and am using the languages to work on a 3d animated tutorial. I have ...
  A: My first thought is that you should be including the correct headers - which for MS Windows OpenGL ...
about class access modifiers ?4/9/2005
  Q: Somebody told me that the access modifiers is class level, not object level in java, How about in ...
  A: Well, if I understand what you mean, I think you will find C++ is the same as Java. If the access ...
Glad to see you here again!4/8/2005
  Q: How are you doing? May I ask you answer the following two questions? 1/ Is there virtual class, ...
  A: I have been busy with some work on and off over the last year or so which involves me being away ...
Re:About a function that transforms a integar into string3/25/2005
  Q: I am sorry, I got the solution. #include <math.h> #include <stdio.h> I didn't include the ...
  A: Yes. But probably not in your case. Consider: 1.65432 as a double is converted to an int. What ...
About a function that transforms a integar into string3/25/2005
  Q: This is the code, and I keep getting an error which I can not understand... char* ToString(int ...
  A: Yes. pow is not a built in feature of the core language. It is a function that is part of the ...
parse error before '<'3/20/2005
  Q: I meant to implement a function that should use the for_each feature, so I was looking at some ...
  A: Cor! At last a _real_ C++ question! Sorry, but this weekend I have add all sorts of off topic only ...
Dll help3/18/2005
  Q: ok i am trying to make a dll, that in c++.net that i can access from vb.net. I made a Class ...
  A: First I shall apologise for any shortcomings in this answer. Your question is not really a C++ ...
only 2 questions3/12/2005
  Q: #include <iostream.h> #include <string.h> #include <conio.h> class Animal{ protected: char ...
  A: First off, did you try to compile the code? Any mistakes in the use of the language would be picked ...
Another question, about strings.3/11/2005
  Q: I'm trying to find out, if a string consists of all numbers or not. I have basically coded something ...
  A: OK, let's go through a few things. First you need to differentiate between C-style character strings ...
Constructors3/11/2005
  Q: If an error has occured during the memory allocation.How to handle this in constructor?
  A: Assuming you have a standard compliant compiler then if an exception is thrown during construction ...
array3/10/2005
  Q: A Hrec contains the below information: Name : 30 characters Height : float My program should be ...
  A: Well first you need to define the Hrec type. In C you would use a struct to make a user defined ...
Hello, on breaking down strings3/1/2005
  Q: I was wondering if there is a method in which i can break down a string into single characters. as ...
  A: FOLLOWUP: --------_ One thing I forgot to mention, if you wish to output a char as its numeric ...
C++ Question2/28/2005
  Q: How would you create a function to either take input from a file, or from keyboard entry. All being ...
  A: As this is a C++ question I shall assume a standard C++ environment - which if you are using the ...
Error C2228 and what is std::string::npos?2/27/2005
  Q: McArdell, thanks for the answers given for the subject: Count the number of occurrences of a word in ...
  A: First I would like to point out that you should not freak out when you get errors from the compiler ...
Count the number of occurrences of a word in string2/25/2005
  Q: Im trying to learn C++. Im a beginner. I have written a code to count the number of occurrences of a ...
  A: Well I would say for a start that you are learning C rather than C++ - or those parts of C++ ...
hello, about passing functions again..(Part II)2/18/2005
  Q: Oh, I'm sorry I forgot to add this on the previous question. And if I do this: .. .. int ...
  A: Oddly, although you get a load of very long names in the error this is due to expanding the names of ...
hello, about passing functions again..2/18/2005
  Q: first of all i would like to start off with a thank you note for the previous question answered. ...
  A: FOLLOWUP --------------- I read your rating comments. Please note that I am not angry that you ...
passing values through a function2/12/2005
  Q: McArdell, I am an amatuer C++ programmer and I am having some difficulty grasping the concepts of ...
  A: Well, you have several misconceptions in the code you posted. First, it seems you have not checked ...
I found the answer to a question I asked earlier, and wanted to thank you for your help2/12/2005
  Q: I asked you a question earlier about loading modules using the DL library. I did find the answer to ...
  A: I rejected your question because until you asked I had not looked into the UN*X dl API calls so was ...
Lists with pointers2/11/2005
  Q: I've been trying to figure this out for a while: Here is a simple list class: class ListElement ...
  A: Ah! The joys of linked lists! First the list does _not_ contain the values - it contains lists ...
GAME PROGRAMMING2/6/2005
  Q: CAN U TELL ME HOW CAN I MAKE GAMES USING C OR C++.PLEASE DO TELL ME IN DETAIL IF U CAN.
  A: Well, I cannot go into too much detail as that sort of level of advice would fill several books - ...
linking1/30/2005
  Q: Hey I dont really know much about c++ (so far my laguage is delphi) But I was woundering is it a ...
  A: The answer is that in general C++ would be as good as Delphi for this sort of thing. It is not so ...
visual basic 6 vs borland C++1/29/2005
  Q: I am curently using visual basic 6 in corporation with microsoft access. I want to know any ...
  A: First I am not qualified to remark on Borland specific features – such as how good their GUI IDE ...
How to Seprate the views of an MDI application into different DLLs?1/28/2005
  Q: Actually i've an idea to develop a MDI application into different DLLs, means i need to use 1 MDI ...
  A: This appears _not_ to be a C++ question but a MS Windows development question (albeit probably using ...
Program for co-ordination of mouse1/23/2005
  Q: I will be pleased if u give me a program for c++ which displays mouse pointer on the screen...i.e. ...
  A: Sam? Who is Sam? I am Ralph McArdell, not Sam. I am a C++ expert however. You are not going to ...
C++/CGI question..1/8/2005
  Q: If they work like the C pre-processor directives then processing will consist of passing HTML to the ...
  A: Well I am not going to tell you how to code it in great detail as if I did I would effectively be ...
Need advice for C++ programmer career1/7/2005
  Q: I just got a job as Network Assistant in a small company cause' I have MCSE. But my major was ...
  A: First in many ways the languages you code in are not all that important. Of course you need to know ...
C++/CGI question..1/2/2005
  Q: I'm a C++ amatuer trying to develop a message board on CGI. I have downloaded various message ...
  A: Well as I do not even know what the product is (and no, please do not tell me as I am not that ...
C++ beginner12/26/2004
  Q: A little about myself. I am about to change careers and want to enter the world of programming. C++ ...
  A: From your question I gather you have no previous programming or software development experience. ...
error C2071 issue12/10/2004
  Q: I have a C file written as below: ----------------------------------------------- #include ...
  A: FOLLOWUP --------- Correction: #line is standard in C and C++ of course! And the preprocessor ...
case sensitive problems12/10/2004
  Q: I am Eddie, another expert here in C++. Another expert and I couldn't figure this stumper out. In a ...
  A: The reason is (if you read the documentation carefully) is that you are dealing with MS Windows ...
size of file in C++12/5/2004
  Q: my question is: can we use the function "sizeof" to find out the size of a certain file? If yes ...
  A: In short no. First sizeof is _not_ a function it is an operator. You use it to obtain the size of a ...
analyzing string backwards & result11/19/2004
  Q: Help me to understand how to get the program to analyze my input string backwards and forwards and ...
  A: Ok, first let us review what the two types of messages are. First you have errors. These prevent ...
C/C++11/13/2004
  Q: Im just wondering two things. One can C/C++ be used to create online games where players can talk ...
  A: Well, yes C and C++ can be used to create online games - they are used to create all sorts of ...
making a "beep" sound11/12/2004
  Q: I was just wondering how to make a "beep" sound from inside my C++ code. I have already tried ...
  A: Well I cannot say for sure why your program does not do what you wish. I have just tried a similar ...
Bse conversion11/10/2004
  Q: I am wondering how i can write a program that will have the user input an integer (base 10) and the ...
  A: The program should look something like the following outline: - read the base 10 number (string) ...
Strange11/9/2004
  Q: I am writing a C++ program in MS Visual Studio and the problem I'm having is that my program gives ...
  A: Sorry but I can offer only general points from the information you provided. First, obviously when ...
Programming10/22/2004
  Q: I have the following program in C++... A user enters a length in INCHES and i convert it to the ...
  A: C++ you say. This looks like pure C to me, not C++ - OK so a C++ compiler might compile it but it is ...
Overloading the 'new' operator for arrays.10/21/2004
  Q: I have a dataSet class which as a member variable has: Concept* concepts; The class Concept has ...
  A: Sorry, but creating built-in arrays of objects – be they automatically allocated (locally on the ...
dll exported functions10/21/2004
  Q: I want to be able to export functions that would accept strings as parram and return strings from ...
  A: I presume you can in fact call the C/C++ functions from VB but do not get the results you were ...
c++10/21/2004
  Q: Does c++ work in same fashion on both windows and linux platform? If no,what are the differences.
  A: In one sense this question is meaningless. C++ is a computer language and it exists as a set of ...
Setting Printer10/19/2004
  Q: It was quite educating.The irony is that i have all those methods.My problem is that i cant use ...
  A: I have not done so, but the documentation (go read it!) states that this is one of those things you ...
Setting Printer10/19/2004
  Q: I have more than one printer installe don my PC.through visucall c++ ,i want to print a job to a ...
  A: I presume you mean that you wish to do this using the Win32 GDI printer API functions, such as ...
lynux10/17/2004
  Q: My name is carl and i am trying to compile a program. this is what i type to compile it( cpp Wall ...
  A: Well I assume you mean that your operating system is Linux _not_ Lynux. Your first mistake is using ...
windows copy dialog10/17/2004
  Q: i'm looking for a way to replace the windows(XP) copy dialog with my own program that will copy the ...
  A: Hmm, this is not really a C++ problem is it? Not only that but I am not sure in what context this ...
C++ game developing10/13/2004
  Q: how are you. I want to do game programming, you think i can make complete games with c++ ( games for ...
  A: Yes. I think that C++ is a good choice for games development. I think some games developers may ...
Dynamic Memory Allocation10/13/2004
  Q: I have been reading about dynamic memory allocation and how the new operator is used to allocate ...
  A: First we usually just say just "at runtime" not "at the runtime". The second point is that you have ...
Protecting a file from beeing read ...10/10/2004
  Q: I have developed a client-server application. The server sends an AVI file to the client. The client ...
  A: (At the time of writing - Monday 11th October 2004 - I do not know when I can post this answer to ...
ToString method of class exception10/10/2004
  Q: I am writing a C++ program using MS Visual Stodio .Net v. 1.0.3075. I visited the ...
  A: (At the time of writing - Monday 11th October 2004 - I do not know when I can post this answer to ...
Accessing a RS232 port via C/C++10/5/2004
  Q: I'm trying to send information over a RS232 serial port via a C/C++ program but can't seem to find ...
  A: So, you are trying to use MS-DOS/PC-DOS specific feature (as indicated by your use of dos.h and ...
Accessing the parallel port in XP10/4/2004
  Q: I wrote a simple program to access the parallel port in C under Windows 98 and it worked fine.But ...
  A: Note: I do not see why you ask a professed and advertised C++ expert such a question. It has nothing ...
using DLL10/1/2004
  Q: I writes C program, How can I call functions of dynamic- link- library (in format .EXE) Thanks
  A: Oddly this is not a C++ or even a C question! It is a platform specific question. In this case I ...
Im new, and am very confused8/30/2004
  Q: Im in the process of learning c++ from a book i have, Im using Dev-c++ 4.9.9. Win xp pro 1. Whats ...
  A: 1/ The C++ ISO/ANSI standard library header file is iostream. Before there was a standard for C++ ...
HWND of where the mouse is clicked on ...8/26/2004
  Q: I want to write a program which is capable of giving me the handle(HWND) of where the mouse is ...
  A: Did you try the MSDN library? If so did you try a query like “HWND near point”? I tried this using ...
input output manipulation7/23/2004
  Q: This question is about how i can set my blinking cursor at a place that i want? i have been using ...
  A: The C and C++ language standards have _no_ support for such functions - so the Turbo C function you ...
Device Programming7/13/2004
  Q: What additional skill and devices are required for activating any electronic devices with the help ...
  A: Note this is no longer an area of my expertise - I have not looked into this sort of thing for about ...
Dynamic Variable Names7/9/2004
  Q: Is it possible to declare a variable with a name from a string. IE - I call a function with a ...
  A: --------------------------- FOLLOWUP ANSWER: --------------------------- Overnight (yes it was ...
C, C++ or C#?7/5/2004
  Q: I want to start programming with C, as I need a fast flexible language that can do graphics. I have ...
  A: ====================== FOLLOWUP ====================== You were asking about free devleopment tools, ...
compiling C++ on redhat linux8.06/25/2004
  Q: i tried to compile a simple C++ program on my redhat linux8.0 box. its not recognising 'cout' ...
  A: I am not sure what your current configuration of the GNU C++ compiler is but I think it is probably ...
Array Problem6/10/2004
  Q: sry to bother u again, but i have made some progress, i already got the salaries on the array...no I ...
  A: I notice several things about your code. First up is that you are writing C code and not C++ (well, ...
programming a telnet server6/9/2004
  Q: , Im a computer technican professionally and a computer nerd otherwise. Im looking to program a ...
  A: [Sorry for the delay, the AllExpert site has not been accepting answer postings for many hours] You ...
Doubly Linked List5/23/2004
  Q: A_O_A Sir, I implemented Doubly Linked List in C++.But the add and remove method can not work ...
  A: Note that I am _not_ going to send you fully operational code. I will show you where I think you ...
C++ program5/2/2004
  Q: I would like this program to output the file in reverse order i.e the last five starting with the ...
  A: I probably could give you a better answer if you could reduce the amount of code posted - I do not ...
term does not evaluate to a function4/28/2004
  Q: There is a error in this code but I couldn't understand what is the problem.: CDC* pDC; CPen ...
  A: In fact you seem to be using the MFC wrapper classes for the straight Win32 GDI API. I think you ...
Memory Management3/21/2004
  Q: Is there any way I can see the compiler generated code for me.( c++/Unix ) I want to know in deatils ...
  A: Your question may not help with what you want. As to whether you can see the code generated by your ...
can u help me with this question...3/20/2004
  Q: can u help me with this question coz i don't know to start and to do. if u help this, it's really ...
  A: As you know if you read my instructions to questioners I will _not_ do your homework or coursework ...
prime factor3/7/2004
  Q: this is all messed up. i dont know what to do. please help void exercise23() { int compOne; int ...
  A: Neither do I. I do not know what exercise 23 is about nor do I recognise the term "hailstone ...
C++2/28/2004
  Q: I have written c++ code for metric analysis. If I given a c++ program as an input, the system should ...
  A: 1/ You have not clearly stated what your problem is. Is the program not functioning as you expected ...
MVS2/22/2004
  Q: I did some C++ programming about 10 years ago and wanted to get back into it to write a simple game ...
  A: First let me say that this is _not_ a C++ question. It is a product support question. Lucky for you ...
What is virtual inheritance?2/14/2004
  Q: What is virtual inheritance? Thanks, lzzzz
  A: This is something you find may be required if you are using multiple inheritance. In that case it is ...
Can I ask you what is 'software development process'?1/25/2004
  Q: Can I ask you what is 'software development process'? Because I find different books have different ...
  A: You can ask, however as it is not a C++ question I do not know if my answer will be any good. I ...
in_stream text files1/24/2004
  Q: How would take characters from one in_stream text file and integers from a different in_stream file ...
  A: I am not going to write the program for you but this is the outline: Open input file 1 for reading ...
You might know the microsoft technology 'late-binding'. Is late-binding the same as polymorphism?1/17/2004
  Q: You might know the microsoft technology 'late-binding'. Is late-binding the same as polymorphism? ...
  A: Hope your new year is going well also. This question has little to do with C++. If you mean ...

All Questions in This Category

Email this page
     
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2006 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.