Rev 426 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 426 | Rev 436 | ||
---|---|---|---|
Line 1674... | Line 1674... | ||
1674 | int8_t * fgets_(int8_t * const string, int16_t length, File_t * const file) |
1674 | int8_t * fgets_(int8_t * const string, int16_t length, File_t * const file) |
1675 | { |
1675 | { |
1676 | int8_t *pbuff; |
1676 | int8_t *pbuff; |
1677 | int16_t c = 0, bytecount; |
1677 | int16_t c = 0, bytecount; |
Line 1678... | Line 1678... | ||
1678 | 1678 | ||
- | 1679 | if( (!Partition.IsValid) || (file == NULL) || (string == NULL) || (length < 1) ) return (0); |
|
1679 | if((!Partition.IsValid) || (file == NULL) || (string == NULL) || (length > 1)) return (0); |
1680 | |
1680 | pbuff = string; |
1681 | pbuff = string; |
1681 | bytecount = length; |
1682 | bytecount = length; |
1682 | while(bytecount > 1) // read the count-1 characters from the file to the string. |
1683 | while(bytecount > 1) // read the count-1 characters from the file to the string. |
1683 | { |
1684 | { |
- | 1685 | c = fgetc_(file); // read a character from the opened file. |
|
1684 | c = fgetc_(file); // read a character from the opened file. |
1686 | |
1685 | switch(c) |
1687 | switch(c) |
1686 | { |
1688 | { |
1687 | case 0x0A: |
1689 | case 0x0A: |
1688 | *pbuff = 0; // set string terminator |
1690 | *pbuff = 0; // set string terminator |