Thanks for the welcome my friend
ok here's what i have
insert
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define Max 1000
main (){
FILE * in=fopen("paragraph.txt","r");
int choice,n=1,w;
char ch;
char str[Max];
int i,j,a,b,len,rem;
if (in==NULL){
printf("Cannot Locate File\n");
exit (1);
}
while ((ch=getc(in))!=EOF){
str[n++] = ch;
}
// for(i=0;i<n;i++){
// printf("%c",str[i]);
// }
printf("Please enter your desired lenght of a line:");
scanf("%d", & w);
len=0;
rem=w;
for (j=1;j<=n;j++){
printf("%c",str[j]);
if (j%w==0){
printf("\n");
}
len++;
rem=rem-len;
}
system ("pause");
return 0;
}
}
i'm trying to format it so that if there isn't enough space for a word go to a new line. Cna't quite code that part