I can't quite wrap my head around a good approach to to randomly printing a word (as a string of characters) into an already printed box of random letters. I figure this would all be done to a file, but considering I'm an amateur at file manipulation, this is difficult.
I can construct the box of letters:
Code:
void bld(char str[11]){int i, j, rng;
char alpha[27] = "abcdefghijklmnopqrstuvwxyz";
FILE *fp;
fp = fopen("foo.txt", "w")
for (i=0; i < VER; i++){
for (j=0; j < HOR; j++){
rng = rand() % 26;
fprintf(fp, "%c", alpha[rng]);
}
fprintf(fp, "\n");
}
fclose(fp);
return;
}
From here, I'm at a mental road block.
Does anyone know any good methods for modifying the printed string?