In my program I open two files and write data into each, and close them. this is done in a while loop.
int main() { while() { myFile = fopen("file1.txt","w"); myFile2 = fopen("file2.txt","w"); // write data into files using fprintf() in a for loop fclose(myFile); fclose(myFile2); } }
However, after some iterations the fopen() for myFile2 fails.
Debug assertion failed! Program.... File ......srcfprintf.c Line 55
Expression (str != NULL)
I have not been ableto locate the bug in the code that is causing the failure.
I've created a new dialog in my MFC dialog based application. the new dialog contains 5 control buttons. The following happens and I don't understand why?
1. click on buttonX. (result ok, OnBnClicked message is sent) 2. click on on any place of the application, but not on the dialog.(removing focus from dialog) 3. click again on buttonX (FAILED, OnBnClicked message is NOT sent). but if instead I click on any other button in the dialog (result ok, OnBnClicked message is sent).
And when I do:
1. ... 2. ... 3. click on the dialog area just to set focus on the dialog again 4. click again on buttonX. (result ok, OnBnClicked message is sent) **I need to do step 3 only if I want to click again on the buttonX! why?? I think it related to SetFocus() but I m not sure how.
I've tried different style like, tool windows, overlapped, popup. it happens in all the cases.
Code: class CToolsDlg : public CBDialog { DECLARE_DYNAMIC(CToolsDlg) public: CToolsDlg(CWnd* pParent = NULL); // standard constructor virtual ~CToolsDlg(); CToolTipCtrl m_ToolsTips;
I am trying to build a program that takes a user password (6+ characters, One uppercase, one lower case, and one number), and checks for errors. The idea is that if the user is doing something wrong (say, forgetting to use an uppercase letter), the program will tell them what the error is, and prompt them to enter the program again.
I get through the building process without errors, but whenever I run the program, I get this error: [URL] ....
Here is my code:
#include <iostream> #include <cctype> using namespace std; bool checkPass(char [], int); //Password Checking Function char convert(string);
[Code] ....
According to the box, the error appears on line 56 and 68.
Basically, I'm moving a VC project from my Windows 7 build machine to a new build machine that's running Windows 8.1. One of the pre-build steps (for a particular project) runs a script which needs to call the M4 macro processor (which is installed on my C: drive). I've been pretty careful to set everything up the same on both machines (including my PATH) but when I try to build the project on my Windows 8 box, MSVC's IDE shows me this error output when running the script:-
I'm getting an error message that I can't seem to fix. The error clearly states that during the link aspect of the debugging and build there is an error that says that the stdio.h file is either missing, invalid or corrupt. When I try to program using any of the other headers I'm getting the same error. The files are there I can see them in the include folder, so I'm asking what can I do to fix all these headers and beware I am a beginner at programming and using any kind of compiler.
This is the error I receive. 1>------ Build started: Project: hello, Configuration: Debug Win32 ------ 1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========
This is the compiler I am required to use for an online course and all instruction is given for the Microsoft visual 2010 express edition. Also the only file I think that's being referenced is the #include <stdio.h>.
#include <iostream> #include <stdlib.h> //used for random numbers #include <time.h> #include <string> using namespace std; int main() { int bridgeWidth ; //set bridge width to any number
I've been using a timer to refresh the listview on my application, but after half a second, I get the error message at first try/catch method in RefreshPlot() in PlotComponent.cs:
Quote An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in Marketplace.exe but was not handled in user code
Additional information: There is already an open DataReader associated with this Connection which must be closed first.
Basically I wanna make my textbox to contain only positive numbers. I was able to do that via masking and regex. I should let you know that the column is bound to a variable which is an int. Therefore, the user always have to type an int (no letters or characters). Like I said, I have been able to prevent user from typing anything but numbers.
Now to the problem:When the user leaves the cell blank and chooses to get out of that cell, they'd get "Input string was not in correct format" next to that cell.
-My approach is: whenever there is nothing in the cell, just replace it with 0. I have code that I thought will do that, but it wont. Seems like the cell was not null, because the if clause won't execute. This is the code:
-Another approach is to change the display or the error message to like "Please enter a number." I have tried doing this but no luck. When I try this concept with the code below, it pops me a dialog box say "Do you wanna change the value?". I dont want it to pop up a dialog box. Also, i was looking for a message that I tried to give it. Looks like it doesn't even get in the if clause because I have checked. And its because its not null? I dont know. This is the code:
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { GridView view = sender as GridView; GridColumn priority = view.Columns["Priority"]; if (view.GetRowCellValue(e.RowHandle, colPriority) == null) { e.Valid = false; //Set errors with specific descriptions for the columns view.SetColumnError(colPriority, "Incorrect Value"); } }
PS:I have checked that both of these methods get executed, so it isn't like they don't. I used some console.write stuff to check this.
Every time I try to compile this, I get the error message, "error: no matching function for call to" on lines 18, 45, and 46. Basically every time I try to call on the function sales and printStock. I don't know what the message means or why I get it.
#include <iostream> #include <fstream> #define N 10 using namespace std;
I am trying to get this simple validation loop to work so that it only displays the error message when the input is outside the range 1-3. yet it always seems to display the message.
I need to have a program display an error message if the variable entered isn't an integer but then I want it to cin again. I have this but it doesn't work:
cout << "Enter an Integer: " ; for (;;) { cin >> var; if (!cin) {
[Code] ....
I am not sure how to do what I want and this doesn't work, it just repeats That wasn't an int.. over and over again.
getting an invalid null pointer error message after a successful build. This program is supposed to ask for firstName, lastName, age and maJor and keep doing so until the age that is input is 0 and then the program closes. Here is what I have.
#include <iostream> #include <string> using namespace std;
I'm trying to print a single linked list backward with functions/classes. I have created the main file and 3 header files. But I'm getting an error on one of the header files, linkedListIterator after adding #include "linkedListType.h". It says that "linkedLlistType.h" is calling itself. And when I try to run it, I get an error of "too many header files." I have tried changing the headers many times, but nothing seems to work.
.cpp file:
/*(Printing a single linked list backward) Include the functions reversePrint and recursiveReversePrint, as discussed in this chapter, in the class linkedListType. Also, write a program function to print a (single) linked list backward. (Use either the class unorderedLinkedList or the class orderedLinkedList to test your function.)*/
I have a MFC Com Dll that has a CDialog. In the OnCreate event I create an ActiveX control. The dll is hosted inside an executable of mine. In this scenario everything works fine!
The dll is also called from an external executable and then a Debug Assertion in OCCSITE.cpp occurs when I create the ActiveX control. I suspect that in the executable there is no AfxOleInit. I spend some time with this problem and tried to CoInitialize, OleInitialize, AfxOleInitModule and even AfxOleInit in the dll. But all that does not change a thing. If I understand the mechanics then this is an intended behaviour and should be done in the host exe.
In my executable m_bNeedTerm is 0 and in the external one (where the ActiveX does not work) it is -1. In AfxOleInit this is explained as a special flag to prevent the dll from doing an unnecessary OleInitialize. But as I said even if I call OleInitialize myself I get the Debug Assertion and the ActiveX is not visible.
Is there anything I can do to make the ActiveX control work in the external application? Obviously I cannot Change anything in the application...
Following function is causing run-time assertion. I am using VC6.0 professional version. My OS is Win7.0. I am calling the function from OnDraw. OnDraw does not contain any other code other than the function call code:
Code: void CMoireUseCirclesView::UseCircle(CDC* pDC){ int x1, y1, x2, y2; x1=20; y1=100; x2=200; y2=280; int color1=0; int color2=0;
Loaded 'ntdll.dll', no matching symbolic information found. Loaded 'C:WindowsSysWOW64kernel32.dll', no matching symbolic information found. Loaded 'C:WindowsSysWOW64KernelBase.dll', no matching symbolic information found. Loaded symbols for 'C:WindowsSysWOW64MFC42D.DLL'
So here I have a program that is supposed to basically sort out who passed and failed. I am currently stuck on the switch statement, I'm trying to count how many students received an A, B, C, etc.
I have developed the msword automation using the following link
[URL] ....
and using VC++ in Visual studio 2010,and msoffice 2007.
Its working fine. but the exe can not run in windows xp (same msoffice 2007 and installation folder also same). i do not know what is the problem. plz tell about how compactability in both os and different version of office like 2003, 2007, 2010, etc....