11.2.1: How to Incorporate Data Files in Your Code Blocks- For C++

Construction Guide for LibreTexts 2e · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-SA 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    11.2.1: How to Incorporate Data Files in Your Code Blocks- For C++

    There are a number of ways data files and can be incorporated into code blocks. However, ensure that you have already followed the steps in the introduction to the CKEditor Binder Plugin Tutorial here.

    Method 1: Using wget

    The first method that can be used to get a data file in your code block is with wget. Follow the example below and replace the example URL with the one attained in the previous step.

    !wget https://chem.libretexts.org/@api/deki/files/265970/auto-mpg.data

    Remember to press the "Run" button prior to pressing "OK". Printing both the code and output will provide the below result, to avoid this simply check "Insert Code Only" after pressing "Run" in order to achieve the example above.

    !wget https://chem.libretexts.org/@api/deki/files/265970/auto-mpg.data
    --2020-05-18 04:16:31--  https://chem.libretexts.org/@api/deki/files/265970/auto-mpg.data
    Resolving chem.libretexts.org (chem.libretexts.org)... 13.35.254.13, 13.35.254.77, 13.35.254.102, ...
    Connecting to chem.libretexts.org (chem.libretexts.org)|13.35.254.13|:443... connected.
    HTTP request sent, awaiting response... 302 Moved Temporarily
    Location: https://files.mtstatic.com/site_4334/265970/0?Expires=1589777816&Signature=HQdyAtgRqX~iKJAn8V8XF-kwzvhhBEh2Ru3hh-7~c7-a2MYbWKcKeYCrtY801FmXtthL0Vs9XJ3cnL36ZR0dmnGJQ0XWorZn4btiyaTZMyGgiJ8m09LQ-6np-MayHoZOTRYqyTfgk7TpTLs8ipW3IcMgFak5VFURpGYs7ZtGysk_&Key-Pair-Id=APKAJ5Y6AV4GI7A555NA [following]
    --2020-05-18 04:16:31--  https://files.mtstatic.com/site_4334/265970/0?Expires=1589777816&Signature=HQdyAtgRqX~iKJAn8V8XF-kwzvhhBEh2Ru3hh-7~c7-a2MYbWKcKeYCrtY801FmXtthL0Vs9XJ3cnL36ZR0dmnGJQ0XWorZn4btiyaTZMyGgiJ8m09LQ-6np-MayHoZOTRYqyTfgk7TpTLs8ipW3IcMgFak5VFURpGYs7ZtGysk_&Key-Pair-Id=APKAJ5Y6AV4GI7A555NA
    Resolving files.mtstatic.com (files.mtstatic.com)... 143.204.201.91, 143.204.201.75, 143.204.201.32, ...
    Connecting to files.mtstatic.com (files.mtstatic.com)|143.204.201.91|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 30286 (30K) [application/octet-stream]
    Saving to: ‘auto-mpg.data’
    
         0K .......... .......... .........                       100% 11.2M=0.003s
    
    2020-05-18 04:16:31 (11.2 MB/s) - ‘auto-mpg.data’ saved [30286/30286]
    
    

    Once the data file has been loaded, use C++ code that you may normally use to read out the lines in the data file


    This page titled 11.2.1: How to Incorporate Data Files in Your Code Blocks- For C++ was last modified on Mon, 22 Jul 2024 03:44:59 GMT and is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.