after the user in put the name it is supposed to save it in xxx.txt file on the a drive then ask user to put the a second name
i think this program should work but it isn't
could anyone help me please
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include <math.h>
void Name(char nombre[16]);
struct Manufacturer
{
char name[16];
int position;
bool pass;
};
void main()
{
struct Manufacturer m;
m.pass=true;
FILE *f;
f=fopen("a:\\xxx.txt","a");
Name(m.name);
while (strlen(m.name)>0)
{
for(m.position=0;m.position<100;m.position++)
{
m.position;
fwrite(&m, sizeof(m),1,f);
Name(m.name);
}
}
fclose(f);
}
void Name(char nombre[16])
{
bool r=true;
do
{
r=true;
puts("Enter Manufacturer name: ");
gets(nombre);
if (strlen(nombre)>=16)
{
printf("Manufacturer name must be less than 15 chars \n");
r=false;
}
}while(!r);
}



LinkBack URL
About LinkBacks



