Hi
Im writing a program to create a textbuffer. I have finished writing the functions that the interface has specified and I wanted to test the functions.
I'm however unable to read in the text file in the form of a char array coz my newTB function is suuposed to take in a char array.
this is my main function where im calling newTB and releaseTB.
Code:
#include <stdio.h>
#include <stdlib.h>
#include "textbuffer.h"
#include "textbuffer.c"
int main (int argc, char* argv[]) {
FILE *f;
f = fopen("testData.txt","r");
TB newtestTB = newTB (f);
releaseTB(newtestTB);
assert( newtestTB==NULL);
return 0;
}
and these are my newTN and releaseTB prototypes:
Code:
/* Allocate a new textbuffer whose contents is initialised with the text given
* in the array.
*/
TB newTB (char text[]);
/* Free the memory occupied by the given textbuffer. It is an error to access
* the buffer afterwards.
*/
void releaseTB (TB tb);