49,762 Topics
![]() | |
// find new size nNewArraySize = StrNewSizeForCharReplace(pszString, pszFindString, pszReplaceString); // nNewArry size is 1063 // alllocate memory pszTemp= (unsigned char*)malloc(nNewArraySize + 1); // add 1063 character in to pszTEmp // 1063 nLength = strlen(pszTEmp) // length is 1063 free(pszTemp); // Heap memory exception How can remove this exception | |
why doesn't this work? [CODE]int main() { fstream file; char output[100], pasword[100]; int a; const string x("Yes"); const string y("No"); string z; char b; cout << "\nEnter correct password to continue: \n" << endl; cin.getline(output, 15); if(output == "file.txt") { cout << "Change password? Type Yes or No. \n" << … | |
[code] main() { double **vals = NULL; function(vals); } [/code] prototype : [code] //some other dll void function(const double**); [/code] it gives me error : cannot convert double ** to const double **. and yes i dont want to put extra burden on the user side(in main function) to const … | |
Hey again! I ran into a new problem in my university course exercises. Basically, I'm trying to read things from a .txt file. Every line is supposed to get converted into an object called "Client", and lines are formatted like this: <account:int> <firstName:string> <lastName:string> <balance:double> I have written my own … | |
Please give me a sample code in MFC VC++ of CMovingButton move to left and move to right. | |
I have recently learned in school about the dreaded diamond.And I wrote a program using virtual inheritance to overcome the problems.I use g++ and I have the following errors with this program, [CODE]//doing to create an illustration for dreaded diamond #include<iostream> using namespace std; class vehicle { public: virtual void … | |
Iam using ubuntu 10.04 LTS.I have a problem in including graphics.h in the g++ compiler I am using.I have nearly tried all the possible solutions given while i googled about it. Please help me .I am a beginner to programming. | |
I need to write a function that sorts a two-dimensional array using this header: [CODE]void sort(int m[][2], int numberOfRows)[/CODE] my code is supposed to primarily sort the rows and secondarily sort the columns. The program is supposed to take ten points entered by the user and sort them. I cannot … | |
hello , i have an trouble in switching between graphics mode and text mode i have an interface by using graphics mode and when you press in a key of it will transfer to a window by text mode when this operation occur the dimension of the second window is … | |
how would one define RANDOM FILES as well as suggest ways of creating and updating them in Visual C++? | |
I'm creating a logfile interpreter program that consists of two editboxes. The first editbox contains the original logfile code, and the second editbox contains the equivalent code of the first editbox in user-readable format. All I want to do now is, everytime I select or highlight a specific code in … | |
hey my name is duplaix..am new in c++ so i need help! I have to write the following set of c++ functions ï‚· fromBinaryToDecimal: The function must accept a pointer to a one-dimensional, dynamically allocated, Boolean array together with an integer representing its length as parameters. You may assume that … | |
Hello everyone! Im new to programming and Im working on an assignment but I keep running into trouble. My assignment is to make a trivia game and although I have made pretty good progress, I am stuck on one particular part. The part I am stuck at is I am … | |
Can someone explain to me, the purpose of the "public" and "private" options of a class? | |
The memset function declared in memory.h is declared this way... void* memset(void* dest, int c, size_t count); and the MSDN example of its use I have shows this for setting the 1st four bytes of a buffer to a '*'... memset(buffer, '*', 4); The 2nd parameter confuses me a bit … | |
Can you recommend a free C++ compiler and editor under windows which is good for error tracking? I mean, I can step the program line by line, and check the values of variables? | |
hi everbody I was opening all files in a certain folder I've used WIN32_FIND_DATA, FindFirstFile, FindNextFile. it works well but for certain extension that i ask the user to enter i.e it will get only all the files with the extension given by he user and ignore any thing else … | |
take two following classes: [CODE=c++] class Test1{ public: Test1()=default; Test1(char in1,char in2):char1(in1),char2(in2){} char char1; char char2; }; class Test2{ public: Test2()=default; Test2(char in1,char in2):char1(in1),char2(in2){} private: char char1; char char2; };[/CODE] I know in c++0x both of these classes are considered as POD types and we can initialize objects of them … | |
take two following classes and their constructors as samples: [CODE=c++] class One{ public: One(int a,int b):adad1(a),adad2(b){} private: int adad1; int adad2; }; class Two{ public: Two(int input[]){ for (int i=0;i<10;i++) araye[i]=input[i]; } private: int araye[10]; };[/CODE] considering objects with static storage duration, I think first constructor can be applied during … | |
How does an optimizing c++ compiler determine when a stack slot of a function(part of stack frame of a function) is no longer needed by that function, so it can reuse its memory? . By stack slot I mean a part of stack frame of a function, not necessarily a … | |
[B]Tic-Tac-Toe Game[/B] Write a program that allows two players to play a game of tic-tac-toe. Use a 2D char array with three rows and three columns as the game board. Each element of the 2D array should be initialized with a space. The program should work as follows. 1. When … | |
I was having an error, it says cannot convert string into int..i have no idea how to convert string into int. My teacher asked me to read 5 students names into the array..help me pls.. [CODE] #include<iostream> #include<string> #include <stdlib.h> using namespace std; int search(int data[], int size, int value) … | |
Quick help please I am writing some data to a file but I do not know the information required in the third line until after the file is completed is there a way to point the ofstream back to the beginning of the file so that i can edit it … | |
Hi everyone; I have a character array of 13 elements and I already defined the first 5 ones. The rest chars are constant so all I need to do is assign the chars between 6-12 instead of writing them one by one.To make it clearer, say my string is "ILoveYouMary" … | |
*I need help solving this. Stuck half way. Would someone mind giving me an example of their program of this?* The local t-shirt shop sells shirts that retail for $12. Quantity discounts are given as follows: Number of shirts Discount 5-10 10% 11-20 15% 21-30 20% 31 or more 25% … | |
Ok, this has got me banging my head against a wall. I have a structure defined in a header file. It get initialized in my "main.cpp" file, then later in a separate file "readconfig.cpp" it gets accessed to store information. I haven't been able to get it to compile except … | |
Hi, what are the classes that cannot be instantiated in c++? I know that one of the ans is Abstract base class.what is the other one in c++? could you please help us? | |
I am new to programming but when I took my class on Visual Basic it seemed so easy and I learned it so fast. It seemed like a giant puzzle. Now I am taking a introduction course to C++ and I cannot seem to grasp the material at all. When … | |
Is there a macro that can get a text as input like "abc" and then extract characters in that text and generate a code using them, something like "{'a','b','c'}" ? thanks. | |
Suppose we have following two classes: [CODE=c++] class Temp{ public: char a; char b; }; class Final{ private: int a; char b; char c; public: Final(Temp in):b(in.a),c(in.b){} //rest of implementation };[/CODE] can we initialize an object of the Final class with following syntax in upcoming c++0x standard: [CODE=c++] Final obj(Temp{'a','b'});[/CODE] |
The End.