|
以下是程序:
[code:1]
#include <stdio.h>
#include <assert.h>
#include <string.h>
struct emploee_info{
char no[5];
char name[8];
char sex[3];
int age;
int salar;
};
int main(int argc, char **argv)
{
FILE *fuck;
struct emploee_info *gan;
//memset(gan, 0, sizeof(gan));
if ((fuck = fopen(argv[1], "w")) == NULL) {
printf("open file fault.....\n");
exit(1);
}
fprintf(fuck, "编号\t姓名\t性别\t年龄\t工资\t\n");
#if 1
printf("请输入职工号:\n");
scanf("%s", gan->no);
printf("请输入姓名:\n");
scanf("%s", gan->name);
printf("请输入性别:\n");
scanf("%s", gan->sex);
printf("请输入年龄:\n");
scanf("%d", &gan->age);
printf("请输入工资:\n");
scanf("%d", &gan->salar);
// printf("%d\n",gan->salar);
// fclose(fuck);
// if ((fuck = fopen(argv[1], "w+")) == NULL) {
// printf("open file fault.....\n");
//exit(1);
// }
// fseek(fuck, 0, SEEK_END);
if (fuck&&gan) {
fprintf(fuck, "%-12s%-12s%-12s%-12d%-12d\n", gan->no, gan->name, gan->sex, gan->age, gan->salar);
}
#endif
}
[/code:1]
哪里错了?
谢谢! |
|