cwk_path_set_style.md (1324B)
1 --- 2 title: cwk_path_set_style 3 description: Configures which path style is used. 4 --- 5 6 _(since v1.0.0)_ 7 Configures which path style is used. 8 9 ## Description 10 ```c 11 void cwk_path_set_style(enum cwk_path_style style); 12 ``` 13 14 ## Description 15 This function configures which path style is used. A call to this function is only required if a non-native behaviour is required. The style defaults to ``CWK_STYLE_WINDOWS`` on windows builds and to ``CWK_STYLE_UNIX`` otherwise. The following styles are currently supported. 16 17 * ``CWK_STYLE_WINDOWS``: Use backslashes as a separator and volume for the root. 18 * ``CWK_STYLE_UNIX``: Use slashes as a separator and a slash for the root. 19 20 ## Parameters 21 * **style**: The style which will be used from now on. 22 23 ## Example 24 ```c 25 #include <cwalk.h> 26 #include <stdio.h> 27 #include <stddef.h> 28 #include <stdlib.h> 29 30 int main(int argc, char *argv[]) 31 { 32 size_t length; 33 34 cwk_path_set_style(CWK_STYLE_WINDOWS); 35 cwk_path_get_root("C:\\test.txt", &length); 36 printf("The root length is '%zu'.", length); 37 return EXIT_SUCCESS; 38 } 39 ``` 40 41 Ouput: 42 ``` 43 The root length is '3'. 44 ``` 45 46 ## Changelog 47 48 | Version | Description | 49 |------------|--------------------------------------------------------| 50 | **v1.0.0** | The function is introduced. |