# SDL Visual Test: C:/Users/DELL/Work/sdlvisualtest/visualtest/src/rwhelper.c File Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
rwhelper.c File Reference
`#include <SDL_test.h>`
`#include "SDL_visualtest_sut_configparser.h"`
`#include "SDL_visualtest_rwhelper.h"`

## Functions

void | SDLVisualTest_RWHelperResetBuffer (SDLVisualTest_RWHelperBuffer *buffer)
char | SDLVisualTest_RWHelperReadChar (SDL_RWops *rw, SDLVisualTest_RWHelperBuffer *buffer)
char * | SDLVisualTest_RWHelperReadLine (SDL_RWops *rw, char *str, int size, SDLVisualTest_RWHelperBuffer *buffer, char comment_char)
int | SDLVisualTest_RWHelperCountNonEmptyLines (SDL_RWops *rw, SDLVisualTest_RWHelperBuffer *buffer, char comment_char)

## Detailed Description

Header file with some helper functions for working with SDL_RWops.

Source file with some helper functions for working with SDL_RWops.

## Function Documentation

int SDLVisualTest_RWHelperCountNonEmptyLines | ( | SDL_RWops * | rw,
|  | SDLVisualTest_RWHelperBuffer * | buffer,
|  | char | comment_char
| ) |  |

Counts the number of lines that are not all whitespace and comments using the SDL_RWops object pointed to by `rw`. `comment_char` indicates the character used for comments. Uses the buffer pointed to by `buffer` to read data in blocks.

Returns
  Number of lines on success, -1 on failure.

char SDLVisualTest_RWHelperReadChar | ( | SDL_RWops * | rw,
|  | SDLVisualTest_RWHelperBuffer * | buffer
| ) |  |

Reads a single character using the SDL_RWops object pointed to by `rw`. This function reads data in blocks and stores them in the buffer pointed to by `buffer`, so other SDL_RWops functions should not be used in conjunction with this function.

Returns
  The character that was read.

char* SDLVisualTest_RWHelperReadLine | ( | SDL_RWops * | rw,
|  | char * | str,
|  | int | size,
|  | SDLVisualTest_RWHelperBuffer * | buffer,
|  | char | comment_char
| ) |  |

Reads characters using the SDL_RWops object pointed to by `rw` into the character array pointed to by `str` (of size `size`) until either the array is full or a new line is encountered. If `comment_char` is encountered, all characters from that position till the end of the line are ignored. The new line is not included as part of the buffer. Lines with only whitespace and comments are ignored. This function reads data in blocks and stores them in the buffer pointed to by `buffer`, so other SDL_RWops functions should not be used in conjunction with this function.

Returns
  pointer to the string on success, NULL on failure or EOF.

void SDLVisualTest_RWHelperResetBuffer | ( | SDLVisualTest_RWHelperBuffer * | buffer) |  |

Resets the buffer pointed to by `buffer` used by some of the helper functions. This function should be called when you're using one of the helper functions with a new SDL_RWops object.