文件读写问题 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("通讯地址: ");
&
相关问答:
#include <string.h>
#include <stdio.h>
void main()
{
int i;
char buf[]="abcde";
strncpy(buf,"abc",3);
for(i=0;i <5;i++)
printf(&q ......
一个数如果好等于它的因子之和,这个数就成为"完数",例如6的因子为1,2,3而6=1+2+3,而6=1+2+3,因此6是“完数".编程序找出1000之内的所有完数,并按下面格式输出其因子:6 its factors are 1,2,3
......
struct s1 {
char ch, *ptr;
union {
short a, b;
unsigned int c:2, d:1;
}
struct s1 *next;
};
主要看不懂符号 :
请达人指点一二
http://blog.cechina.cn/true ......
写了一段程序
C/C++ code:
..
MYSQL* mysql;
MYSQL_RES* res;
//我想实现一个查看有没有 mysql结构,如果没有就连接。
void connect()
{
mysql_init(mysql);
mysql_realconnect(. ......
C/C++ 2009-9专家榜
名次 专家名称 专家分 个人描述
1 mstlq (面色铁路桥) 5843 因为菜,所以努力学习中
2 whg01 (及时结贴是美德)&n ......