mirror of
https://github.com/ArashPartow/exprtk.git
synced 2025-07-08 03:09:03 +00:00
C++ Mathematical Expression Library (ExprTk) https://www.partow.net/programming/exprtk/index.html
This commit is contained in:
committed by
Arash Partow
parent
f46bffcd69
commit
cc1b800c2b
@ -3,7 +3,7 @@
|
||||
* C++ Mathematical Expression Toolkit Library *
|
||||
* *
|
||||
* Simple Example 18 *
|
||||
* Author: Arash Partow (1999-2023) *
|
||||
* Author: Arash Partow (1999-2024) *
|
||||
* URL: https://www.partow.net/programming/exprtk/index.html *
|
||||
* *
|
||||
* Copyright notice: *
|
||||
@ -11,6 +11,7 @@
|
||||
* permitted under the guidelines and in accordance with the *
|
||||
* most current version of the MIT License. *
|
||||
* https://www.opensource.org/licenses/MIT *
|
||||
* SPDX-License-Identifier: MIT *
|
||||
* *
|
||||
**************************************************************
|
||||
*/
|
||||
@ -30,31 +31,31 @@ void file_io()
|
||||
typedef exprtk::parser<T> parser_t;
|
||||
|
||||
const std::string fileio_program =
|
||||
" var file_name := 'file.txt'; "
|
||||
" var stream := null; "
|
||||
" "
|
||||
" if (stream := open(file_name,'w')) "
|
||||
" println('Successfully opened file: ' + file_name); "
|
||||
" else "
|
||||
" { "
|
||||
" println('Failed to open file: ' + file_name); "
|
||||
" return [false]; "
|
||||
" } "
|
||||
" "
|
||||
" var s := 'Hello world...\n'; "
|
||||
" "
|
||||
" for (var i := 0; i < 10; i += 1) "
|
||||
" { "
|
||||
" write(stream,s); "
|
||||
" } "
|
||||
" "
|
||||
" if (close(stream)) "
|
||||
" println('Sucessfully closed file: ' + file_name); "
|
||||
" else "
|
||||
" { "
|
||||
" println('Failed to close file: ' + file_name); "
|
||||
" return [false]; "
|
||||
" } ";
|
||||
" var file_name := 'file.txt'; "
|
||||
" var stream := null; "
|
||||
" "
|
||||
" if (stream := open(file_name,'w')) "
|
||||
" println('Successfully opened file: ' + file_name); "
|
||||
" else "
|
||||
" { "
|
||||
" println('Failed to open file: ' + file_name); "
|
||||
" return [false]; "
|
||||
" }; "
|
||||
" "
|
||||
" var s := 'Hello world...\n'; "
|
||||
" "
|
||||
" for (var i := 0; i < 10; i += 1) "
|
||||
" { "
|
||||
" write(stream,s); "
|
||||
" }; "
|
||||
" "
|
||||
" if (close(stream)) "
|
||||
" println('Sucessfully closed file: ' + file_name); "
|
||||
" else "
|
||||
" { "
|
||||
" println('Failed to close file: ' + file_name); "
|
||||
" return [false]; "
|
||||
" } ";
|
||||
|
||||
exprtk::rtl::io::file::package<T> fileio_package;
|
||||
exprtk::rtl::io::println<T> println;
|
||||
|
Reference in New Issue
Block a user