Hi Salem, 8 random words and the comment was written by me thinking that it would display.
I'm very new using the unix platfrom too and on top of it using c programming.
This file was placed in the /u/myname/words.txt not sure if that will automatically pull from the correct location as seen above.
Code:
/* Author: Me
** This is my Hangman program, what a mission it was to make this work.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CHANCES 10
#define MAXIMUM 8
#define maxAttempts 10
#define MAX 8
int main ( void )
{
char words[MAX];
int value, j, k;
int count = 0;
FILE *fp;
/* Read the file of words into the array*/
fp = fopen ("/users/rashied/words.txt", "w+");
for (k =0; k < MAX; k++)
{
fprintf(fp,"%s\n", words[k]);
printf("The words in the array are %s\n","words.txt");
}
fclose(fp);
}
i tried displaying with the following but still no luck of displaying the data - see below.