Trinket is closing down in August, but don't worry we will be moving our projects to the free offer from GoCodeIt.
Loading settings.
Many applications read and write settings into an initialisation (ini) file. Typically the data in the file is structured into blocks identified with square brackets. Each setting has a name, followed by an equal sign, followed by the data. E.g. in the example below, port is a setting and the data is 143.
[modified by]
name=Dave Hillyard
[database]
; use IP address in case network name resolution is not working
server=192.0.2.62
port=143
Write a program that reads the contents of a text file as shown above and outputs the data contained within it in the format:
Last modified by: Dave Hillyard
IP address: 192.0.2.62
Port number: 143
Use this boilerplate code as a starting point:
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
Note the data attributes can be anywhere in the file, not necessarily in the order presented above.
File contents for settings.ini:
[modified by]
name=Dave Hillyard
[database]
; use IP address in case network name resolution is not working
server=192.0.2.62
port=143
Output:
Last modified by: Dave Hillyard
IP address: 192.0.2.62
Port number: 143
Use these resources as a reference to help you meet the success criteria.
Run the unit tests below to check that your program has met the success criteria.
Last modified by: Dave Hillyard
IP address: 192.0.2.62
Port number: 143
Check that you have: