Click here to Skip to main content
15,900,378 members
Everything / Programming Languages / C++98

C++98

C++98

Great Reads

by Andreas Gieriet
HTML page with all syntax/grammar productions of C++98/C++11
by Intel
This earthquake detector application is part of a series of how-to Intel® Internet of Things (IoT) code sample exercises using the Intel® IoT Developer Kit, Intel® Edison board, Intel® IoT Gateway, cloud platforms, APIs, and other technologies.
by goranorsander
A class template for specializing fundamental types
by stevemk14ebr
A modern, universal, c++ hooking library.

Latest Articles

by goranorsander
A class template for specializing fundamental types
by Marcell Lipp
This tip shows how to unit test a private function in C++.
by Alexey Shtykov
A few words about function templates
by Intel
This earthquake detector application is part of a series of how-to Intel® Internet of Things (IoT) code sample exercises using the Intel® IoT Developer Kit, Intel® Edison board, Intel® IoT Gateway, cloud platforms, APIs, and other technologies.

All Articles

Sort by Updated

C++98 

9 Feb 2024 by Rick York
There are three steps to making a control in a dialog work with an MFC program. You did two of them and omitting the third will result in the behavior you observed. The third step is to add an edit control to your IDD_NOTEBOOKS_DIALOG with the...
9 Feb 2024 by k5054
You need to call m_Edit.create( style, rect, parent, ID) before you can use the CEdit object.
9 Feb 2024 by shupike
Hello! Need some help - I have MS VC++ 6 project; so I'm just trying to add EDIT control to the one of my modal window (IDC_EDIT1), variable m_Edit1 (CEdit) and even after that this is impossible to open such window. Application crashed with...
13 Jul 2023 by Member 12702056
What is the difference between char zero and normal zero in c++? especially i mean in c++for example,char x=0;int x=0;and char x='0'or just like '0'what is the difference between all of them?what is the exact meaning of them?Please,help me :)What I have tried:I know that...
20 May 2023 by steveb
clear() in STL containers does not re-shrink the allocated storage. If you call capacity(), you will get the real allocated storage size on an emptied container. If you must release the allocated storage you would need to call swap() function...
20 May 2023 by Mathi Prasad
Hi Team, i have tries to analysis the memcheck throughout while insertion of new elements in list, map, vector anything. am getting high memory utilization at particular PID in linux. After the list object as clearing, still am seeing the same...
18 May 2023 by CPallini
See, for instance: https://stackoverflow.com/questions/12050777/how-to-return-memory-from-process-to-the-os[^]
18 May 2023 by OriginalGriff
What did you expect? You are creating 10,000,000 streams, and adding them all to a list: list l1; for(int i=0;i
26 Apr 2023 by OriginalGriff
Wrong site: This is for software development - you need a vet, probably.
15 Jan 2023 by Ketaki Palshikar
This is my Code C++ for my assignment. Please help me to convert it to C code. Thank you! What I have tried: #include #define NODE 4 int graph[NODE][NODE]; int path[NODE]; void displayCycle() { //Function to display the cycle...
13 Jan 2023 by Member 8840306
I am new in C++ 98 .I want to write to FILE data type in C++ using netbeans 8.0. Here is my code that show that load the data in form Here is the main.cpp #include #include int main(int argc, char...
13 Jan 2023 by Richard MacCutchan
Your fwrite call parameters are incorrect: fwrite(name, sizeof(name) , sizeof(name) , fptr); That means you will try to write 50 characters 50 times. It should be: fwrite(name, sizeof(name) , 1, fptr); // write the name once only And the...
5 Jan 2023 by Member 8840306
I am new in QT using C++ 98.I am setting the stylesheet in QT from of 5 label and 5 button using this class function Code 1(working), void Display::setting_Style() { ...
5 Jan 2023 by Michael Haephrati
There are a few issues with the code you provided in Code 2: In the first loop, you are trying to access the widget member of the signalMapper object, but this object does not have a widget member. You need to use MyForm::getMyForm() to get a...
25 Dec 2022 by Member 8840306
I am new in C. I am using C with QT-4. I am trying to write the text file having two colums . Here is my text file that is space separated hi Name hi Grade DDD Class EEE Grade2 BBB Class3 ky Grade3 DDD Class4 EEE Grade4 Here is my code ...
25 Dec 2022 by OriginalGriff
You are trying to write to the file while you read from it: that only works if the data lines are all exactly the same length, and you seek to the right position each time you want to read or write: mixing reads and writes in a normal text file...
25 Dec 2022 by Rick York
First there are few problems with your code. Before addressing those, here are a few other things I would do. First, define a type for the strings you are using. : const int StrSize = 49; typedef char textStr[ StrSize + 1 ]; The +1 is used so...
21 Dec 2022 by Member 8840306
I am new in C++. I am using C++ 98.Here is my code. It is getting the text from a `lineEdit` of a Qt4 form. strcpy(Name,ui->lineEdit->setText(QString::fromStdString(Name)) );...
21 Dec 2022 by CPallini
Do you mean 'align the columns without using tabs'? If that is the case, then you have to read the file twice: the first time for finding the maximum column lengths. The second time to produce the output, using the appropriate number of blanks.
16 Nov 2022 by Member 8840306
I am new in C++ 98 with QT-4 in netbeans 8.1 . I am trying to make data base connection using this code. #include "newForm.h" #include #include #include #include using namespace std; #include...
16 Nov 2022 by OriginalGriff
Auto commit mode means that as soon as a statement is executed, Commit is called on the connection. At a guess - and I have no access to your system for testing - the setSchema call throwing an error probably means that the DB name...
12 Nov 2022 by Richard MacCutchan
Your problem is that all those header files cannot be found. It may be that they are in a subdirectory of your project, in which case you need to change the angle brackets to double quotes, thus: #include "mysql_driver.h" #include...
12 Nov 2022 by Member 8840306
I am new in QT in C++ 98. I have made this project using netbeans Netbeans C++ QT Application [image] In this project I have made new QT From QT Form [image] I am trying to import SQL but it failed.Using this code in "newFrom.cpp" ...
27 Oct 2022 by Death Smoke
Hi all, I Searched how to delete a whole key from the Registry using c++ anyone here can help me because i didnt find any clear example about this subject. the key path is like here : Computer\HKEY_USERS\folder \folder\ folder\{Key name}. So...
25 Oct 2022 by Michael Haephrati
In the code below you can see how to delete a subkey or the entiry key HKEY hKey = NULL; long lReturn = RegOpenKeyEx( HKEY_USERS. _T("folder \folder\ folder\{Key name}"), 0L, ...
20 Oct 2022 by Rick York
Have you investigated the RegDeleteKeyExA function (winreg.h) - Win32 apps | Microsoft Learn[^] ? Here is another sample : Deleting Registry Key with Subkeys Win32 C program example[^]
19 Oct 2022 by Death Smoke
I Want to convert the output of this code to string type , but i cant make it. #pragma warning(disable : 4996) #include int main() { char cmd[10]; strcpy(cmd, "dir"); system(cmd); } What I have tried: I tried to...
19 Oct 2022 by CPallini
Are you possibly searching for popen? See, for instance: The Marvelous popen() Function | C For Dummies Blog[^]
19 Oct 2022 by Alexandrnn
#include #include int main() { system("dir"); puts((char*)stdin); } #include #include #include int main() { char cmd[10]; strcpy_s(cmd, 10, "dir"); system(cmd); puts((char*)stdin); }
16 Oct 2022 by merano99
The command system() creates a new process to handle the specified command. char cmd[10]; strcpy(cmd, "dir"); system(cmd); In most cases, this is neither performant nor useful. But of course you can start a process with C this way. You could...
23 Sep 2022 by Member 8840306
I am new in C++ .I am trying to load blob image which is stored in .bin file from sql Database. That .bin file store blob image in form of string like BM6 ect(each .bin have 3 to 4 char). Here is code(working) that save the blob image(.bmp) in...
18 Sep 2022 by Member 8840306
I am new in qt c++. I am trying to load blob image which is stored in .bin file in phpmyadmin db .That .bin file store blob image in form of string like BM6 ect(each .bin have 3 to 4 char). Here is my code that execute on button click driver...
18 Sep 2022 by Rick York
BM6 is the header of a bitmap file, followed by a double quote character - 0x22. Following the 0x22, there are four nulls. You can not expect to copy a bitmap's binary data using strncpy because there are null characters in it and they will...
16 Sep 2022 by mathi1234
Hi, am getting SEGEXIT signal from one thread, please help me what is the issue ? and then how to see this ?... string l_Resp = "Code"+"For Project"; log("String formation done successfully, ready for pushing");...
16 Sep 2022 by Rick York
Your code is incomplete. We don't know what the types of some of your data is like g_DeliveryRpt. I would add another call to log after the mutex is acquired like this : string l_Resp( "Code For Project" ); log("String formation done...
16 Sep 2022 by Greg Utas
I can't tell what's happening based on the information that you've provided. The stack trace appears to reach some const_iterator function in std::list. Did it throw an exception? The stack trace seems to be from another thread, because neither...
22 Aug 2022 by Josh_0101
Hi. I'm trying to use a pointer by accessing the memory address which I only know the hexadecimal value. Is it possible to do that? For example, I know the address of the pointer is 0x7ffee96f6d3c and I want to manually access it outside from an...
22 Aug 2022 by Patrice T
Quote: I got error: invalid conversion from ‘long int’ to ‘int*’ :( Modern OS are using 64 bits pointers, but integers are commonly 32 bits. So conversion of a 64 bits pointer to a 32 bits integer lead to a loss of data. You may need to use a 64...
22 Aug 2022 by Rick York
How is it that you "know" that address? Normally, addresses of data items will change every time a program runs. If it is a physical address then you need to have acquired it through a driver and even it can change every time your program runs....
22 Aug 2022 by OriginalGriff
Just to add to what Greg and Carlos have said ... A hexadecimal address in a pointer is not a "real" memory address - the OS maps the real memory allocated to the process to a virtual address which is used by the pointers within the app. So...
22 Aug 2022 by CPallini
Quote: Can a pointer access based on a known memory address? Yes, provided they are in the same process. If you need to access it from another process then you are out of luck.
22 Aug 2022 by Greg Utas
You can do this within the same program (process), but most platforms prevent one process from reading the data of another process. To do that, you'd have to use a system call to make the memory accessible to another process.
8 Aug 2022 by Denesh Neupane
i am trying to read the data from sd card in c++/CLI app using serial communication.i tried the following error but didnot get expected output. What I have tried: SD_Handle handle; uint16_t status; char readBuffer[12] SD_init(); handle =...
5 Jul 2022 by merano99
This question seems to be a very popular Homework. There also seems to be a solution for a fee....
5 Jul 2022 by Member 15697402
USE DEV C++ MENU TYPE FOLLOW INSTRUCTIONS MACHINE PROBLEM A new video store in your neighborhood is about to open. However, it does not have a program to keep track of its videos and customers. The store managers want someone to write a...
5 Jul 2022 by KarstenK
Try with starting some Learn C++ tutorial or some video tutorial. some tips: use functions and classes with understandable names and install some IDE like Visual Studio.
5 Jul 2022 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
28 Jun 2022 by Member 15078716
QUESTION: How do I write the file contents with a BOM? __________ Using CodeBlocks 17.12 / GCC 5.1 / Microsoft Windows XP . From my previous question on page Save file with unicode string in old windows system[^] "Quote: If I want to update...
27 Jun 2022 by merano99
For UTF-8 you code this: DWORD dwBytesWritten = 0; BOOL bErr = 0; TCHAR *fname = TEXT("A_Unicode_WriteSTuff_天_file.txt"); HANDLE hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);...
25 Jun 2022 by merano99
I can't get the code sample to compile without further tricks. The compiler points out that you need a special code page for the special (chinese?) character. // warning C4566 : The character represented by the universal character name "\u5929"...
25 Jun 2022 by Member 15078716
Hello. If I want to update some software for my uncle's old saw mill machine that has a programmable controller with C, and I want to code it in C or C++98 or in C++03, nothing newer, then how do make the following work for that? I am doing a...
25 Jun 2022 by merano99
The questioner had stated that he uses Code:Blocks with MinGW under Windows. MinGW seems to have problems with UNICODE, other compilers like Visual-Studio or TDM-GCC realize at least under Windows with wchar_t. The C++ standard does not seem to...
17 Jun 2022 by Member 8840306
I want to draw map boundary(red dash line) by reading (lat,log) from this file that i made from google earth that is space separated file. 45.521282 56.506097 46.061904 58.982127 46.477755 61.11857 46.563424 66.067484 46.510663 66.351164...
19 Apr 2022 by mathi1234
Hi, actually i have done the attachment of socket fd with normal openssl code. but due to need of encryption has to introduce bio in my code but i do not know how to introduce it. and then why am using TCP socket fd in ssl means have to use...
19 Apr 2022 by k5054
You can use SSL_get_rbio() and SSL_get_wbio() to get the read and write BIOS associated with an SSL connection. Alternatively instead of using SSL_connect(), you can use SSL_accept() which returns a BIO suitable for reading and writing.
22 Feb 2022 by CDotpp
I'am developing a Book Management System. My Code Writing datas to a txt file. Datas Holding Like; Book ID Book Name Author Name Page Count-> 213154 Harry Potter and the Philospher's Stone J. K. Rowling 224 I write an update fucntion for when...
22 Feb 2022 by I_M_R
Hello, It seems it is not best way to manage book data by using *.txt file. I must ask you how did you open your source file ( files ) input file or output file ? For reading, writing, to append? Files will include data in ansi characters txts...
31 Dec 2021 by CHill60
We are more than happy to help those that try for themselves but we will not write your homework for you. It doesn't do you any favours and just makes the next exercise even harder for you to complete (your tutor will assume you don't need any...
31 Dec 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
27 Dec 2021 by Richard MacCutchan
fstream bookreg; fstream temp; int count = 0; cout
27 Dec 2021 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
2 Nov 2021 by OriginalGriff
We can't help you: we have no idea where you are getting the error, when it occurs, what you do to get it, or what code might be involved. This is a site for software development problems: you write code, we try to help you fix it. But even if...
11 Jul 2021 by Member 10045851
I have deleted files by using batch file commands on a main hard disk on my duel boot Windows 8.1 - 10 laptop. I know there is a easy way to recover them but cannot remember how. What I have tried: attrib -r -a -s -h *.*. Have also tried the...
11 Jul 2021 by Southmountain
this is a solution for you to try: Recover Deleted Files Using Command Prompt in Windows 10 – Hassle Free Solution. the method 2 is also good to try.
11 Jul 2021 by OriginalGriff
Try this: Recover lost files on Windows 10[^]
3 May 2021 by Member 15048716
crate a program in c++ with 2 function 1 function calculator that take operands and operators from user and 2nd function take table and start and end number from user and press that data using passing by reference methond What I have tried: ...
3 May 2021 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
25 Apr 2021 by Greg Utas
The C equivalent of iostream is stdio.h. It looks like most of the work involves rewriting the lines that use cin and cout to use stdio.h. See here[^] and here[^].
13 Apr 2021 by OriginalGriff
As I said last time, don't write it yourself, there are plenty of examples out there. You are trying to be lazy and "Let the system do the work" for you, and with CSV that just won't work - you need to process the whole string intelligently, as...
13 Apr 2021 by Richard MacCutchan
You have been given suggestions already at How do I read comma and quotation delimited file in C++?[^]. You need to check if a token starts with a double quote, and if so , ignore all separator characters until you find the closing quote. The...
12 Apr 2021 by Member 14559341
The file has CompanyNo, Items baught (3 from every company), totalpaid, totalreturn(due to bad product), relation with other company(if any(companyNo)) a787, apple, banana, strawberry, "32,888.00", "0.0" k798, g456 f238, "Orange, Juice", Kiwi,...
12 Apr 2021 by OriginalGriff
It's called CSV (Comma Separated Values) and if you do a quick Google you will find loads of examples / libraries which can read it: read csv c - Google Search[^] Personally, I wouldn't write my own - it's not a trivial job to get right because...
12 Apr 2021 by Greg Utas
It looks like the words to be grouped together are enclosed in quotation marks, so you'll have to add that to your parsing logic. When parsing within quotation marks, you'll have to get the next word and add it to the one you're working on after...
12 Apr 2021 by Member 14559341
Hey I am trying to read file that contains Boss, level, Specials, "FireMen", 3, "Flame,Thrower", Fire,Breath "Medusa", 6, "Snake,Poison" "Hype", 10, "One,punch,Knock", Fly,Kick, "Dragon,Breath" I am...
9 Apr 2021 by Member 14559341
the class(staff) contains objects int ID, string Name, string Class The vector contains vector s = { {234, "Mark", "biology"}, {3455, "Mitch", "English"}, {1234, "Hen", "Maths"}} How can I sort...
9 Apr 2021 by CPallini
Try #include #include #include using namespace std; int main() { struct staff { int id; string name; string cls; }; vector s = { {234, "Mark", "Biology"}, {3455, "Mitch",...
9 Apr 2021 by Member 14559341
I am reading file that contains Johh, 13, soccer, cricket Mitchell, 14, cricket Michael, 13, football, cricket, soccer (all three in separate lines starting from names) I have created class with objects called name, age and favourite sport. is...
9 Apr 2021 by CPallini
Yes, you can. Try, for instance #include #include using namespace std; class student { string name; int age; vector sport; public: student(string name, int age, vector sport):name(name), age(age),...
9 Apr 2021 by OriginalGriff
Yes, just add a collection of Sport objects to the Student class (or whatever the people are) and add each sport as a separate instance to that. Exactly what collection depend on the environment you are running in, a CLI project might use a .NET...
3 Jan 2020 by goranorsander
A class template for specializing fundamental types
5 Dec 2019 by Member 14646837
solve as son as please help me in this program iam very sad be this question cannot sole What I have tried: in objective oriented progamming
5 Dec 2019 by Richard MacCutchan
Console programs do not use the mouse, they are text based.
15 Nov 2019 by RickZeeland
I think you need some JUCE, see: free-cross-platform-mobile-and-desktop-no-web-app-development-frameworks-that-can-be-used-to-create-commerci~juce[^]
15 Nov 2019 by Member 14586345
hi everybody. i have some problems with graphics.h functions in c++. 1) how can i add constant background image to my code? i tried initwindow and readimagefile fuctions but when i put that in for loop each time it opens new window and when i put it out of for loop it disappears when loop...
28 Oct 2019 by Marcell Lipp
This tip shows how to unit test a private function in C++.
5 Jul 2019 by Member 14522494
#include using namespace std; void replace(char input[],int start) { if(input[start]=='\0'||input[start+1]=='\0') // base condition if string return; //contains no element or 1 element // there won't be ...
5 Jul 2019 by Nilesh Sinha
replacing pi word with 3.14 .it is showing the output but forcing me to close the program,any help regarding this will be appreciated. What I have tried: #include #include #include #include #include using namespace std; void swa(char b[]); int...
23 Jun 2019 by megaadam
I agree 100% with CPallini. But in order to help the OP I would like to clarify like this: Whether an argument is passed by reference or value is determined ONLY by the the function declaration NOT the function call. If and only if you have a "&" in the function declaration: the argument is...
23 Jun 2019 by Member 14509698
I am learning c++ and came across below code in which I did not understand below line. rc = pthread_create(&threads[i], NULL, PrintHello, (void *)&td[i]); Where, rc = return code in int thread is pthread_t threads[5] PrintHello is threadRoutine td is structure with 2 variable 1 is int...
23 Jun 2019 by CPallini
In the below line pthread_create(&threads[i], NULL, PrintHello, (void *)&td[i]); the first argument is not passed by reference (in C++ you must NOT use the & operarator in a call by-reference). It is instead the address (i.e. pointer to) of a pthread_t variable (namely it is the address of the ...
8 Feb 2019 by Member 14135996
#include using namespace std; int main() { string text1 = "Hello, this is a string"; cout
8 Feb 2019 by Thomas Daniels
You need to include : #include
3 Dec 2018 by Richard MacCutchan
You already posted this question at Why my program print the same value?[^]. Please do not repost.
10 Nov 2018 by 11917640 Member
Int64 localp = RerturnLocalPlayer();
10 Nov 2018 by CesatAGS
Hi, i write a dll that is injected on game and return my localplayer and listArrayplayer on server. Ok work fine code dll project: __int64 RerturnLocalPlayer() { __int64 player = GetLocalPlayer_EX();// __Int64 GetLocalPlayer_EX is function that return my player return player; } in my...
13 Jul 2018 by Baderd94
Hi I am designing a GUI for a lab experiment. The GUI displays some reading coming from a hardware device using VC++ 6 and I need to open an empty text file as a notebook for the experimenter. How can i open an empty text file or an app like (Word) as a notebook. What I have tried: I added...
13 Jul 2018 by Richard MacCutchan
You can open an existing file with the append option to add more information. If the file does not exist then just use the create for writing option. The documentation for CFile, and also open, fopen and CreateFile gives full details.
13 Jul 2018 by OriginalGriff
I'm sorry, but ... you probably aren't going to get what you want here (or anywhere else). Think about it: you admit to not having any realistic programming skills, and you want to make a multiplayer based browser game. That's complicated, very complicated - and the person who "helps" you will...
13 Jul 2018 by Member 13910414
//RECTANGLE #include #include #include #include main() { clrscr(); int ch; char ch1; long float l,b,area,peri,diag; cout
13 Jul 2018 by Manish K. Agarwal
You declared int ch; but in switch case you are comparing options char. change case as switch(ch) { case 1: area=l*b; cout