Hello,
I'm a learner. Compiler: MinGW Developer Studio, O/S:Win'98SE.
The program is a mail manager, taken from my "C"
book:"C by Example". On compilation, I'm getting the
warning:"`'flag used with `%s' printf format."
I've tried changing the function's return type, but no go.
How do I resolve this problem?
I'll only post the offending part of the program.
Thank you.
I'm a learner. Compiler: MinGW Developer Studio, O/S:Win'98SE.
The program is a mail manager, taken from my "C"
book:"C by Example". On compilation, I'm getting the
warning:"`'flag used with `%s' printf format."
I've tried changing the function's return type, but no go.
How do I resolve this problem?
I'll only post the offending part of the program.
Thank you.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
/*Global structure of name and address.*/
struct mail_struct
{
char name[25];
char address[25];
char city[20];
char province[20];
char zipcode[7]; /* Extra NULL character.*/
char code[10]; /*For additional expansion.*/
};
/*Global file pointer.*/
FILE *fp;
/*Defined constants.*/
/*MAX is the total number of names allowed in memory for reading
mailing lists.*/
#define MAX 250
#define FILENAME "ADDRESS.DAT"
/*Prototype all of the program's functions.*/
int main(void);
void disp_menu(void);
void enter_name(void);
int change_name(void);
void print_name(void);
void flush_newline(char *line);
void add_to_file(struct mail_struct item);
char pr_data(struct mail_struct item);
void get_new_item(struct mail_struct *item);
void pause_sc(void);
int getzip(char zipcode[]);
/**********************************************************/
int main()
{
struct mail_struct list [MAX];
int ch;
do
{
disp_menu();
scanf(" %d", &ch);
while(getchar()!='\n');
switch(ch)
{
case(1) : {enter_name();
break;}
case(2) : {change_name();
break;}
case(3) : {print_name();
break;}
case(4) : {break;}
default : {printf("You need to enter");
printf(" 1 through 4");
break;}
}
}
while(ch != 4);
getchar();
return 0;
}
char pr_data(struct mail_struct item)
{
/*Prints the name and address sent to it.*/
printf("\nName : %-25s \n", item.name);
fflush(stdout);
printf("Address: %-25s \n", item.address);
fflush(stdout);
printf("City : %- 20s \tProvince: %- 20s ZIPcode: %- 6s \n",
item.city, item.province, item.zipcode);
fflush(stdout);
return 0;
}