read from file problem
Is there any function (Low lewel I/O) which can read some length from file from start position.
I need some function which Have 4 arguments. First is file descriptor or some pointer to file, second is buffer as character array of some lentgth, third argument will be start position and last argument will be length of string readed from file.
example: my_function(fd, buffer, 10, 5);
this function will read first 10 characters of text file start with 5'th character;
If is end of file function must return only characters left to the end of file.
If content of text file is: "This is my text file" and my_function(fd, buffer, 10, 20) - this function will return string = "y text file" and not string = "y text file#########" and # represent some other characters like \0, \n or whatever.
Can anyone help me with this function?
P.S. Sorry for my bad English.
to read from the current position use fread
to set the current position fsetpos or fseek