add ini_get_float function
This commit is contained in:
		
							parent
							
								
									802f55dff4
								
							
						
					
					
						commit
						23f81c94f5
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		
							
								
								
									
										11
									
								
								src/ini.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/ini.c
									
										
									
									
									
								
							|  | @ -155,6 +155,17 @@ int ini_get_int(INIFILE* ini, LPCSTR section, LPCSTR key, int def) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| float ini_get_float(INIFILE* ini, LPCSTR section, LPCSTR key, float def) | ||||
| { | ||||
|     char def_str[32]; | ||||
|     _snprintf(def_str, sizeof(def_str) - 1, "%f", def); | ||||
| 
 | ||||
|     char value[32]; | ||||
|     ini_get_string(ini, section, key, def_str, value, sizeof(value)); | ||||
| 
 | ||||
|     return (float)atof(value); | ||||
| } | ||||
| 
 | ||||
| void ini_free(INIFILE* ini) | ||||
| { | ||||
|     if (!ini) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue