文件读写问题 c高手请进
下面是我的代码 从内存写入文件正确 但从文件读入内存都是乱码 而且程序崩溃 请c高手指点
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct inf
{
char name[10];
char address[20];
long number;
long telnumber;
struct inf *next;
};
struct inf *input(struct inf *head)
{
struct inf *p,*q;
int i,population;
if(head!=NULL)
{
p=q=head;
while(p!=NULL)
{
q=p;
p=p->next;
}
}
printf("请输入要输入的人数!\n");
scanf("%d",&population);
for(i=0;i <population;i++)
{
p=(struct inf *)malloc(sizeof(struct inf));
printf("姓名: ");
scanf("%s",p->name);
printf("通讯地址: ");
&
相关问答:
一个数如果好等于它的因子之和,这个数就成为"完数",例如6的因子为1,2,3而6=1+2+3,而6=1+2+3,因此6是“完数".编程序找出1000之内的所有完数,并按下面格式输出其因子:6 its factors are 1,2,3
......
在ue中从远程unix用二进制方式下载c文件到本地,修改之后用二进制方式上传到unix中,再用vi打开该文件,每行后面就会有一个^M的换行符,如果采用ascii方式下载,二进制方式上传的话就没有^M,那请问这样会对程序文件 ......
开始学OS,按练习要求写的代码在gcc下无法编译:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
void SIGFPEhandler2(int s ......
打印一个N*N的方阵,N为每边字符的个数( 3〈N〈20 ),要求最外层为"X",第二层为"Y",从第三层起每层依次打印数字0,1,2,3,...
例子:当N =5,打印出下面的图形:
X X X X X
X ......
const int num=100
float neiji(float [num]b, float [num]c)
{
int p;
float nj ......