⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 链表(结构体)的c语言实现.txt

📁 图像处理学习的一些心得
💻 TXT
字号:
typedef struct pad_hole_data
{
	int op_code;					
	double x;						
	double y;						
	double cx;						
	double cy;						
	double dia;						
	int ism;						
	int isp;						
	int ids;						
	int layer_id;					
	struct pad_hole_data *next;	
	
}pad_hole_data_t;

typedef struct net_data
{
	double startx;
	double endx;
	double starty;
	double endy;
	double cx;
	double cy;
	int layerid;	
	struct net_data *next;
	
}net_data_t;
typedef struct conductor_net
{	
	char *name;	
	int net_id;
	int visible;					
	int select;						
	net_data_t * ndata;
	pad_hole_data_t *phdata;
	struct conductor_net * next;
	
}conductor_net_t;
int get_length1(conductor_net_t* pList)
{
	int i=0;
	while(pList!=NULL)
	{
		i++;
		pList=pList->next;
	}
	return i;
}
int get_length2(pad_hole_data_t* pList)
{
	int i=0;
	while(pList!=NULL)
	{
		i++;
		pList=pList->next;
	}
	return i;
}
int get_length3(net_data_t* pList)
{
	int i=0;
	while(pList!=NULL)
	{
		i++;
		pList=pList->next;
	}
	return i;
}

void save_net_data_t(net_data_t* pList,FILE *pFile)
{
	int i=get_length3(pList);
	fwrite(&i,sizeof(int),1,pFile);
	while(pList!=NULL)
	{
		fwrite(&pList->startx,sizeof(double),1,pFile);
		fwrite(&pList->endx,sizeof(double),1,pFile);
		fwrite(&pList->starty,sizeof(double),1,pFile);
		fwrite(&pList->endy,sizeof(double),1,pFile);
		fwrite(&pList->cx,sizeof(double),1,pFile);
		fwrite(&pList->cy,sizeof(double),1,pFile);
		fwrite(&pList->layerid,sizeof(int),1,pFile);
		pList=pList->next;
	}
}
void save_pad_hole_data_t(pad_hole_data_t *pList,FILE *pFile)
{

	int i=get_length2(pList);
	fwrite(&i,sizeof(int),1,pFile);
	while(pList!=NULL)
	{
		fwrite(&pList->op_code,sizeof(int),1,pFile);
		fwrite(&pList->x,sizeof(double),1,pFile);
		fwrite(&pList->y,sizeof(double),1,pFile);
		fwrite(&pList->cx,sizeof(double),1,pFile);
		fwrite(&pList->cy,sizeof(double),1,pFile);
		fwrite(&pList->dia,sizeof(double),1,pFile);
		fwrite(&pList->ism,sizeof(int),1,pFile);
		fwrite(&pList->isp,sizeof(int),1,pFile);
		fwrite(&pList->ids,sizeof(int),1,pFile);
		fwrite(&pList->layer_id,sizeof(int),1,pFile);
		
		pList=pList->next;
	}
}

void save(conductor_net_t* pList,FILE *pFile)
{
	int i=get_length1(pList);
	fwrite(&i,sizeof(int),1,pFile);
	
	while(pList!=NULL)
	{
		
		i=strlen(pList->name);
		fwrite(&i,sizeof(int),1,pFile);
		fwrite(pList->name,sizeof(char),i+1,pFile);
		fwrite(&pList->net_id,sizeof(int),1,pFile);
		fwrite(&pList->visible,sizeof(int),1,pFile);
		save_net_data_t(pList->ndata,pFile);
		save_pad_hole_data_t(pList->phdata,pFile);
		pList=pList->next;
	}

}



双向链表
typedef struct _test
{
   struct _test *pNext;
   struct _test *pPrev;

   int id;
   int type;
   int size;
   char* buffer;
   _test::_test()
   {
	   pNext = pPrev = NULL;
	   buffer = NULL;
   }
} test;


test aa={......};可以直接赋值

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -