good day everyone, can somebody help me how to use text files in dev C++. we have a project for extra credit in school. Im making a currency exchange rate 1) view table 2)update the file(change currency rates) 3) make conversions(using the file if possible) .. im just a newbie learning new things :( TIA
- 2 Contributors
- forum 1 Reply
- 2,838 Views
- 9 Minutes Discussion Span
- commentLatest Postby rproffittLatest Post
rproffitt1,693
Let's watch https://stackoverflow.com/questions/47072700/global-currency-converter too.
- Nov 10, 2016 DEV-C for Windows contains all standard features necessary for creating, fixing, and executing programs written in C program languages. As C is an object-oriented expansion of C, it also supports earlier versions of the language.
- Nov 15, 2011 a basic tutorial of Dev C explaining how to display information and get information from the user.
Never use gets, it is a totally unsafe function. Using scanf comes with it's own bunch of problems as well, not least of which is the behaviour of leaving the newline behind, ready to mess up your gets calls. Notice that gets is quite different from fgets: not only gets uses stdin as source, but it does not include the ending newline character in the resulting string and does not allow to specify a maximum size for str (which can lead to buffer overflows). Parameters str.
-->Dev C++ Program Download
Gets a line from the stdin stream. These versions of gets, _getws have security enhancements, as described in Security Features in the CRT.
Syntax
Parameters
buffer
Storage location for input string.
Storage location for input string.
sizeInCharacters
The size of the buffer.
The size of the buffer.
Return Value
Returns buffer if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.
Remarks
The gets_s function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('n'). gets_s then replaces the newline character with a null character ('0') before returning the line. In contrast, the fgets_s function retains the newline character.
![Gets In Dev C++ Gets In Dev C++](/uploads/1/2/6/2/126213900/736268976.png)
If the first character read is the end-of-file character, a null character is stored at the beginning of buffer and NULL is returned.
_getws_s is a wide-character version of gets_s; its argument and return value are wide-character strings.
If buffer is NULL or sizeInCharacters is less than or equal to zero, or if the buffer is too small to contain the input line and null terminator, these functions invoke an invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, these functions return NULL and set errno to ERANGE.
In C++, using these functions is simplified by template overloads; the overloads can infer buffer length automatically (eliminating the need to specify a size argument) and they can automatically replace older, non-secure functions with their newer, secure counterparts. For more information, see Secure Template Overloads.
Dev C++ Tutorial
By default, this function's global state is scoped to the application. To change this, see Global state in the CRT.
Generic-Text Routine Mappings
TCHAR.H routine | _UNICODE & _MBCS not defined | _MBCS defined | _UNICODE defined |
---|---|---|---|
_getts_s | gets_s | gets_s | _getws_s |
Dev C++ For Windows 10
Requirements
Routine | Required header |
---|---|
gets_s | <stdio.h> |
_getws_s | <stdio.h> or <wchar.h> |
The console is not supported in Universal Windows Platform (UWP) apps. The standard stream handles that are associated with the console, stdin, stdout, and stderr, must be redirected before C run-time functions can use them in UWP apps. For additional compatibility information, see Compatibility.
Example
See also
Stream I/O
gets, _getws
fgets, fgetws
fputs, fputws
puts, _putws
gets, _getws
fgets, fgetws
fputs, fputws
puts, _putws