Re code below:
Question 1. After inputting data.name (say John Smith) and terminating with Enter, the data.actionCode cannot be entered. Sm is entereded instead. How can I change that?
Question 2. In the line "fwrite .." I don't understand the period in "...out),1,fptr..." . How much data has to go in, is already determined by the sizeof(... I have looked at differeten tutorials, still I don't understand.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
struct about
{
char name[35];
char actionCode[2];
};
int main()
{
struct about data;
printf("Concerns : ");
scanf("%s",data.name);
printf("Action Code : ");
scanf("%s",data.actionCode);
FILE *fptr;
fptr=fopen("K:\\descrip", "a+");
fwrite(&data,sizeof(struct about),1,fptr);
fclose(fptr);
return 0;
}