Thread: how to declare Pointer to string list structure in c++

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    78

    Unhappy how to declare Pointer to string list structure in c++

    hi i am getting runtime exception for Pointer to string list structure


    itis showing exception in the line:

    "UF_STRING_t * sectionEditData=NULL;"




    Code:
    void defGeometry::ReplaceSpline(std::vector<struct geometricSection>sections)
    {
    	int j=1;
    	tag_t PartTag=NULL_TAG;
    	tag_t feat_tag=NULL_TAG;
    	char feat_name[]="THROUGH";
    	UF_STRING_t * sectionEditData=NULL;
    	PartTag=UF_PART_ask_display_part();
    	UF_CALL(UF_OBJ_cycle_by_name_and_type (PartTag, feat_name, UF_feature_type, FALSE, &feat_tag));
    if(!feat_tag)
    	{
    		sysLogPrint("Failed to create spline !");
    }
    else
    {
    	sysLogPrint("s.t=%d",feat_tag);
    	if(!UF_CALL(UF_OBJ_delete_object(feat_tag)))
    	{
    		sysLogPrint("sucess!");
    	}else
    	{
    		sysLogPrint("failed!");
    	}
    }
    for(int i=0;i<ActionSide.NumberOfSections;i++ )
    {
    	UF_MODL_init_string_list(&sectionEditData[i]);
    	UF_MODL_create_string_list(1, 4, &sectionEditData[i]);
    	sectionEditData[i].string[0]=4;
    	sectionEditData[i].dir[0]=UF_MODL_CURVE_START_FROM_BEGIN;
    		sectionEditData[i].id[0]=sections[i].section_tags[0];
    		sectionEditData[i].id[1]=sections[i].section_tags[1];
    		sectionEditData[i].id[2]=sections[i].section_tags[2];
    		sectionEditData[i].id[3]=sections[i].section_tags[3];
    	if( j<=3)
    	{
    		UF_CALL(UF_MODL_replace_feat_strings (feat_tag, UF_MODL_STRING_REPLACE, &sectionEditData[i], 1, j++));
    	}
    	else
    	{
    		UF_CALL(UF_MODL_replace_feat_strings (feat_tag, UF_MODL_STRING_ADD, &sectionEditData[i], 1, (j++)-1));
    	}
    	UF_MODL_update ();
    	free(sectionEditData);
    }
    };

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Is the defGeometry object that this member function is being called on valid? Can you check the this pointer at the time of the exception and see if it is null or otherwise corrupted?

    That simple assignment causing an exception probably indicates that the memory is corrupted somewhere else.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 04:13 PM
  2. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  3. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  4. problem with structures and linked list
    By Gkitty in forum C Programming
    Replies: 6
    Last Post: 12-12-2002, 06:40 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM