Click here to Skip to main content
15,902,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: html help and ms front-page Pin
Hans Dietrich29-Sep-09 20:19
mentorHans Dietrich29-Sep-09 20:19 
QuestionWhere is regedit.exe located in Pocket PC? Pin
Le@rner29-Sep-09 19:03
Le@rner29-Sep-09 19:03 
AnswerRe: Where is regedit.exe located in Pocket PC? Pin
Game-point29-Sep-09 19:14
Game-point29-Sep-09 19:14 
QuestionDirectX - Direct Show programming? Pin
$uresh $hanmugam29-Sep-09 18:35
$uresh $hanmugam29-Sep-09 18:35 
QuestionHow to disable non-visible dialog items Pin
FloatingMarc29-Sep-09 16:19
FloatingMarc29-Sep-09 16:19 
AnswerRe: How to disable non-visible dialog items Pin
includeh1029-Sep-09 19:30
includeh1029-Sep-09 19:30 
GeneralRe: How to disable non-visible dialog items Pin
FloatingMarc29-Sep-09 21:56
FloatingMarc29-Sep-09 21:56 
QuestionRun Time error Pin
monkeywrench1029-Sep-09 16:14
monkeywrench1029-Sep-09 16:14 
I'm baffled. I know where the problem line is. I just don't understand the problem except to add that it likely relates to either pointer or reference or both. Hopefully, all code needed is included. Thanks in advance. Sorry for the code dump, but I think it may all be needed....(since I don't really know what the problem is....

Unhandled exception at 0x5dd97b3f (msvcp90d.dll) in Parser6.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.

FROM OUTPUT...
First-chance exception at 0x5dd97b3f (msvcp90d.dll) in Parser6.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.
Unhandled exception at 0x5dd97b3f (msvcp90d.dll) in Parser6.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.


Here is the line from some internal file that is getting pointed at by the compiler. FileName = xutility. Bad line is labeled.

inline void __CLR_OR_THIS_CALL _Container_base_secure::_Orphan_all() const
{ // orphan all iterators
_Lockit _Lock(_LOCK_DEBUG);
if (_Myfirstiter != _IGNORE_MYITERLIST)
{
for (_Iterator_base **_Pnext = (_Iterator_base **)&_Myfirstiter;
*_Pnext != 0; *_Pnext = (*_Pnext)->_Mynextiter)
BAD LINE HERE --> (*_Pnext)->_Mycont = 0;
*(_Iterator_base **)&_Myfirstiter = 0;
}
}


Here is the Collector constructor with the problem code labeled near the end.
Note that the constructor is taking in a reference. This may be related to error.
#include "Collector.h"
#include "Token_stream.h"
#include "Multiplier.h"
#include <vector>
#include <iostream>
using namespace std;


Collector::Collector(Multiplier& myMultiBox, int MaxSNM): myMultiplier(myMultiBox)
{
	cin.clear(); 
        cin.ignore(1000, '\n');
	BaseIP  =     GetOctets2( MaxSNM);
        NetworkBits = ConvertToNetworkBits( BaseIP);
	
        vector<SimpleBox*> Boxes;
	vector<int> test(31,9);
	for (int i = 0; i < (myMultiplier.GetTheBoxSet()).size(); i++)
	{
		Boxes = (myMultiplier.GetABoxMaker(i))->GetMyBoxes();
		for (int z = 0; z <  Boxes.size(); z++)
		{
		
THIS DOESN'T WORK->     Boxes[z]->SetMyNetworkBits(test);
THIS DOESN'T WORK->	Boxes[z]->SetMyBaseIP(BaseIP);
THIS WILL RUN ALONE->	Boxes[z]->PRINT_NETWORK();
		}
	}

}


Here is main

#include "AllHeaders.h"
using namespace std;

int main()
try{
      StartMeUp KickStart;
                  
      Multiplier MultiBox(KickStart.GetMyHosts());
      BoxMaker* temp  = MultiBox.GetABoxMaker(0);
      BoxMaker* temp1 = MultiBox.GetABoxMaker(1);
	  BoxMaker* temp2 = MultiBox.GetABoxMaker(2);
	  BoxMaker* temp3 = MultiBox.GetABoxMaker(3);
      
          PureStack FirstT(temp );
          StackSmallHigh SecondT(temp1);
	  PureReserve ThirdT(temp2);
	  ReserveSmall FourthT(temp3);
          cout << endl;
      
int MaxSNM = temp->GetMyVLSM();

Collector TheCollector(MultiBox, MaxSNM);
    
             
    system("PAUSE");
    return 0;
}

catch (exception& e)
    {
        cerr << e.what() << endl;
        keep_window_open ("~1");
        return 1;
    }
catch (...) 
    {
        cerr << "exception \n";
        keep_window_open ("~2");
        return 2;
    }


all headers:
#include <iostream>
#include <vector>
#include "StartMeUp.h"
#include "Multiplier.h"
#include "Stroustrup.h"
#include "MakeSmall.h"
#include "BoxMaker.h"
#include "PureStack.h"
#include "StackSmallHigh.h"
#include "PureReserve.h"
#include "ReserveSmall.h"
#include "Collector.h" 


Here are the .h files
Collector
#ifndef Collector_h
#define Collector_h
#include "Multiplier.h"
#include "Token_stream.h"
#include <vector>
using std::vector;

class Collector
{
public:
	Collector(Multiplier&, int );//int is the MaxSubnet for pure stack passed in from main
	int GetMyBaseIP();
	vector<int> GetMyNetworkBits() ;
private:
	//Members
	int MaximumMask;
	vector<Token> BaseIP;
	vector<int> NetworkBits;
	//functions
	vector<Token>  GetNumber(bool, vector<Token>, int, char SNM = '*', int MaxSNM = 30);
    vector<Token>  GetNumberAndDot(bool broken, vector<Token> Octets, int limit);  
    vector<Token>  GetOctets2(/*vector<Token>,*/ int );
    vector<int>    ConvertToNetworkBits(vector<Token>);
	Multiplier     myMultiplier;


};
#endif


Multiplier

#ifndef Multiplier_h
#define Multiplier_h
#include "Token_stream.h"
#include "BoxMaker.h"
#include <vector>
using std::vector;

class Multiplier
{
    public:
    Multiplier(vector<Token> hosts_in);
    vector<BoxMaker*> GetTheBoxSet();
    BoxMaker* GetABoxMaker(int i);
	int GetMyVLSM( int BM);
    
    private:           
       vector<Token> hosts;
       vector<BoxMaker*> BoxSet;
};

#endif


SimpleBox
#ifndef SimpleBox_h
#define SimpleBox_h
#include "Token_stream.h"
#include <vector>
using std::vector;

class SimpleBox
{
      public:
            SimpleBox (vector<Token> hosts);
			
            void ResetStatics();
			void SetMyNetworkBits(vector<int>);
			void SetMyBaseIP(vector<Token> );
            
            void SetNetwork(int network );
            void SetVLSM(int SNM);
            void PrintBoxValue();
            void SetMyHostsTest();
           
             
            int GetMyBlockSize();
            int GetMyNetwork();
            int GetMyVLSM();
            
           void PRINT_NETWORK();
           
            
      private:
             vector<Token> myHostsVector; //passed in
             vector<int>  myHostBits;
             int myBlockSize;
             int myHosts;
             int myNetwork; 
             int myHostElement;
             int myVLSM;
             void FigureBlockSize();
             int myBroadCast;
             vector<int> myNetworkBits;
			 vector<Token> BaseIP;
             int MaxSNM;             
            
             static int s_network;
             static int s_globalcounter;
};

#endif


BoxMaker
#ifndef BoxMaker_h
#define BoxMaker_h
#include "SimpleBox.h"
#include "Token_stream.h"
#include <vector>

class BoxMaker
{
  public:
         BoxMaker (vector<Token> Hosts_in, int i);
		
         void PRINT_TEST();
         vector<SimpleBox*> GetMyBoxes();
	 void SetMyNetwork(int network, int number );
         void SetMyVLSM(int network, int VLSM);
        
	 int GetMyVLSM();
        
  private:
          vector<Token> theHosts;
          vector<SimpleBox*> myBoxes;
          
          
};

#endif


SetmyNetworkBits
#include "SimpleBox.h"
#include <vector>

void SimpleBox::SetMyNetworkBits (vector<int> theNetworkBits)
      {
           myNetworkBits = theNetworkBits;
      }


SetmyBaseIP

#include "SimpleBox.h"
#include <vector>

void SimpleBox::SetMyBaseIP (vector<Token> theBaseIP)
      {
           BaseIP = theBaseIP;
      }

AnswerRe: Run Time error Pin
Cedric Moonen29-Sep-09 20:25
Cedric Moonen29-Sep-09 20:25 
GeneralRe: Run Time error Pin
monkeywrench1030-Sep-09 3:31
monkeywrench1030-Sep-09 3:31 
QuestionUsing an API Pin
Donguy197629-Sep-09 15:34
Donguy197629-Sep-09 15:34 
AnswerRe: Using an API Pin
Saurabh.Garg29-Sep-09 16:13
Saurabh.Garg29-Sep-09 16:13 
GeneralRe: Using an API Pin
dipuks30-Sep-09 3:39
dipuks30-Sep-09 3:39 
GeneralRe: Using an API Pin
Saurabh.Garg30-Sep-09 4:00
Saurabh.Garg30-Sep-09 4:00 
QuestionWrite and read the same file in the same C program? Pin
Razanust29-Sep-09 14:02
Razanust29-Sep-09 14:02 
AnswerRe: Write and read the same file in the same C program? Pin
David Crow29-Sep-09 15:55
David Crow29-Sep-09 15:55 
Questionwhat other files can IE display if without software support? Pin
includeh1029-Sep-09 11:47
includeh1029-Sep-09 11:47 
AnswerRe: what other files can IE display if without software support? Pin
enhzflep29-Sep-09 12:03
enhzflep29-Sep-09 12:03 
AnswerRe: what other files can IE display if without software support? Pin
Saurabh.Garg29-Sep-09 14:19
Saurabh.Garg29-Sep-09 14:19 
GeneralRe: what other files can IE display if without software support? Pin
David Crow29-Sep-09 15:32
David Crow29-Sep-09 15:32 
GeneralRe: what other files can IE display if without software support? Pin
Saurabh.Garg29-Sep-09 15:37
Saurabh.Garg29-Sep-09 15:37 
GeneralRe: what other files can IE display if without software support? Pin
includeh1029-Sep-09 19:08
includeh1029-Sep-09 19:08 
GeneralRe: what other files can IE display if without software support? Pin
Saurabh.Garg29-Sep-09 19:14
Saurabh.Garg29-Sep-09 19:14 
QuestionWhy does upload/download change file size? Pin
includeh1029-Sep-09 9:21
includeh1029-Sep-09 9:21 
QuestionRe: Why does upload/download change file size? Pin
David Crow29-Sep-09 10:51
David Crow29-Sep-09 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.