Please can someone help me doing this program?
1.- Read a text file
2.- Convert the readed text file into array.
3.- That array split it into another small arrays, every n(sizes).
Ex:
[help me] split it in every 3 chars = [hel] [p m] [exx]
Please can someone help me doing this program?
1.- Read a text file
2.- Convert the readed text file into array.
3.- That array split it into another small arrays, every n(sizes).
Ex:
[help me] split it in every 3 chars = [hel] [p m] [exx]
So break the problem down into steps.
Start by just reading the file in, and printing it out again.
Replace stdin and/or stdout with your file handle(s) opened using fopen.Code:int main ( ) { char buff[BUFSIZ]; while ( fgets(buff,BUFSIZ,stdin) != NULL ) { fputs(buff,stdout); } return 0; }
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
So with fgets, you are getting every single character one by one?
fgets = file get string.
It fetches a whole line, up to the first newline / full buffer / end of file (whichever comes first).
Your first action on seeing a function() you've never seen before is to type into google "man function" and do some reading.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.