求大佬指点错误,文件输出空白
//头文件
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<Windows.h>
//extern list_single * list = createList();
struct student
{
char name[20];
char sex[2];
char num[20];
float math;
};
struct list_node
{
struct student data;
struct list_node *next ;
};
typedef struct list_node list_single ;
//创建链表
list_single * createList()
{
list_single * head_Node = (list_single *)malloc(sizeof(list_single));
head_Node->next = NULL;
return head_Node;
}
//创建新结点
list_single *createNode(struct student data)
{
list_single * new_Node = (list_single *)malloc(sizeof(list_single));
new_Node->data = data;
new_Node->next =NULL;
return new_Node;
}
//遍历链表
void print_list(list_single * head_Node)
{
list_single * p_Move = head_Node->next;
printf("num\tname\tsex\tmath\n");
while(p_Move)
{
printf("%s\t%s\t%s\t%.2f\n",p_Move->data.num,p_Move->data.name,p_Move->data.sex,p_Move->data.math);
p_Move = p_Move->next;
}
printf("\n");
}
//插入新结点,头插法
void insert_Node_by_Head(list_single * head_Node,struct student data)
{
list_single * new_Node = createNode(data);
new_Node->next = head_Node->next;
head_Node->next = new_Node;
}
//结点的指定删除
void delete_Node_by_Appion(list_single * head_Node,char* num)
{
list_single * pos_Node = head_Node->next;
list_single * pos_Front = head_Node;
if(pos_Node == NULL)
{
printf("没有找到相关信息,删除失败");
}
else
{
while(strcmp(pos_Node->data.num,num))
{
pos_Front = pos_Node;
pos_Node = pos_Front->next;
if(pos_Node == NULL)
{
printf("未找到相关信息");
return;
}
}
pos_Front->next = pos_Node->next;
free(pos_Node);
}
}
//查找信息
list_single * search_Information(list_single * head_Node,char* num)
{
list_single * p_Move = head_Node->next;
if(p_Move == NULL)
return NULL;
while(strcmp(p_Move->data.num,num))
p_Move = p_Move->next;
return p_Move;
}
//读取文件
void Read_File(list_single * head_Node,char * File_Name)
{
FILE *fp;
struct student data;
fp = fopen("File_Name","r");
if(fp == NULL)
{
printf("error:打开文件失败");
exit(0);
}
while(fscanf(fp,"%s\t%s\t%s\t%f\n",&data.num,&data.name,&data.sex,&data.math) != EOF)
{
insert_Node_by_Head(head_Node,data);//结点插入链表
}
fclose(fp);
}
//文件写
void Write_File(list_single * head_Node,char * File_Name)
{
FILE *fp;
fp = fopen(File_Name,"w");
list_single * p_Move = head_Node->next;
while(p_Move)
{
fprintf(fp,"%s\t%s\t%s\t%f\n",p_Move->data.num,p_Move->data.name,p_Move->data.sex,p_Move->data.math);
p_Move = p_Move->next;
}
fclose(fp);
}
//源#include"single _list.h"
void Menu();
void Uesr_Key();
void Add_Information();
void Printf_Information();
void Deletet_Information();
list_single * list = createList();
void main()
{
Read_File(list,"1.txt");//读取文件
print_list(list);//打印链表
/*while(1)
{
Menu();
Uesr_Key();
}*/
}
文件创建没有问题,内容写入文件也成功,但是输出文件的时候却全是空白。求大佬指点,题主c语言小白,感谢大佬帮助
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<Windows.h>
//extern list_single * list = createList();
struct student
{
char name[20];
char sex[2];
char num[20];
float math;
};
struct list_node
{
struct student data;
struct list_node *next ;
};
typedef struct list_node list_single ;
//创建链表
list_single * createList()
{
list_single * head_Node = (list_single *)malloc(sizeof(list_single));
head_Node->next = NULL;
return head_Node;
}
//创建新结点
list_single *createNode(struct student data)
{
list_single * new_Node = (list_single *)malloc(sizeof(list_single));
new_Node->data = data;
new_Node->next =NULL;
return new_Node;
}
//遍历链表
void print_list(list_single * head_Node)
{
list_single * p_Move = head_Node->next;
printf("num\tname\tsex\tmath\n");
while(p_Move)
{
printf("%s\t%s\t%s\t%.2f\n",p_Move->data.num,p_Move->data.name,p_Move->data.sex,p_Move->data.math);
p_Move = p_Move->next;
}
printf("\n");
}
//插入新结点,头插法
void insert_Node_by_Head(list_single * head_Node,struct student data)
{
list_single * new_Node = createNode(data);
new_Node->next = head_Node->next;
head_Node->next = new_Node;
}
//结点的指定删除
void delete_Node_by_Appion(list_single * head_Node,char* num)
{
list_single * pos_Node = head_Node->next;
list_single * pos_Front = head_Node;
if(pos_Node == NULL)
{
printf("没有找到相关信息,删除失败");
}
else
{
while(strcmp(pos_Node->data.num,num))
{
pos_Front = pos_Node;
pos_Node = pos_Front->next;
if(pos_Node == NULL)
{
printf("未找到相关信息");
return;
}
}
pos_Front->next = pos_Node->next;
free(pos_Node);
}
}
//查找信息
list_single * search_Information(list_single * head_Node,char* num)
{
list_single * p_Move = head_Node->next;
if(p_Move == NULL)
return NULL;
while(strcmp(p_Move->data.num,num))
p_Move = p_Move->next;
return p_Move;
}
//读取文件
void Read_File(list_single * head_Node,char * File_Name)
{
FILE *fp;
struct student data;
fp = fopen("File_Name","r");
if(fp == NULL)
{
printf("error:打开文件失败");
exit(0);
}
while(fscanf(fp,"%s\t%s\t%s\t%f\n",&data.num,&data.name,&data.sex,&data.math) != EOF)
{
insert_Node_by_Head(head_Node,data);//结点插入链表
}
fclose(fp);
}
//文件写
void Write_File(list_single * head_Node,char * File_Name)
{
FILE *fp;
fp = fopen(File_Name,"w");
list_single * p_Move = head_Node->next;
while(p_Move)
{
fprintf(fp,"%s\t%s\t%s\t%f\n",p_Move->data.num,p_Move->data.name,p_Move->data.sex,p_Move->data.math);
p_Move = p_Move->next;
}
fclose(fp);
}
//源#include"single _list.h"
void Menu();
void Uesr_Key();
void Add_Information();
void Printf_Information();
void Deletet_Information();
list_single * list = createList();
void main()
{
Read_File(list,"1.txt");//读取文件
print_list(list);//打印链表
/*while(1)
{
Menu();
Uesr_Key();
}*/
}
文件创建没有问题,内容写入文件也成功,但是输出文件的时候却全是空白。求大佬指点,题主c语言小白,感谢大佬帮助
...全文
相关推荐
JasperReport浏览器输出PDF为空白页的解决方案
NULL 博文链接:https://donald-draper.iteye.com/blog/2301345
解决vue-cli项目打包出现空白页和路径错误的问题
今天小编就为大家分享一篇解决vue-cli项目打包出现空白页和路径错误的问题。具有很好的参考价值。希望对大家有所帮助。一起跟随小编过来看看吧
解决Vue项目打包后打开index.html页面显示空白以及图片路径错误的问题
主要介绍了解决Vue项目打包后打开index.html页面显示空白以及图片路径错误的问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
vue打包静态资源后显示空白及static文件路径报错的解决
今天使用vue打包(npm run build)遇到了几个坑,在这里分享给大家 打包之后打开dist的页面显示空白: 这个问题以前就处理过,是打包过程中出现错误频率较高的一种,可能有3处地方会出现这种情况 1、记得改一下config下面的index.js中bulid模块导出的路径。因为打包后的index.html里边的内容都是通过script标签引入的,默认显示的路径不对,打开肯定是空白的。 build: { index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname
把替换后引起空白的6个原始文件
把替换后引起空白的6个原始文件


