I have a text file with some sentences I would like to output onto the screen.
The time to come.
Normal, common, or expected.
A special set of clothes worn by all the members of a particular group or organization
Already made use of, as in a used car.
Bing
A circle of light shown around or above the head of a holy person.
The god of thunder.
An act that is against the law.
Long dress worn by women.
Odd behaviour.
This is the code I have used to make the output for the Words to these definitions, But Scanf doesn't like spaces, so can someone edit this code to output the definitons above, thanks.
Should of said this eariler but the output should be 1 sentence at one time.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
FILE *fp;
int main(void)
{
struct store
{
char id[128];
}stock[10];
int printnum;
int allrec=0;
int startrec=0;
fp=fopen("Test 24 Definitions.txt","r");
printf("i");
fscanf(fp,"%s",&stock[startrec].id);
while(!feof(fp))
{
printf("%s", stock[startrec].id);
printf(" \n");
getch();
startrec=startrec+1;
allrec=startrec;
fscanf(fp,"%s",&stock[startrec].id);
}
fclose(fp);
printf("\n\n\n\n");
int i;
for (i=0; i<allrec; i++)
{
printf("%s\n",stock[i].id);
getch();
}
}
Sample code with fgets would be appreciated