Reading and Outputting from a File in Juliar

May 3, 2017 | Views: 1913

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

This tutorial assumes you have the latest version of Juliar downloaded on your computer. If not, please see previous tutorials.

Hello Cybrarians and RatTeamsters,

In today’s tutorial, we will be learning how to quickly grab contents of the file and output it onto the screen.

Here are the commands we will be using:

__getByteFromString – gets a byte from a string

if – if condition

while – while condition

fileopen – open file

 

So with __getByteFromString, we can easily grab a byte and print it to the screen.

In order to output everything, we will create a while loop.

string file = fileOpen(“./test.jrl”);

while ( true ){

 

string y = __getByteFromString(file, index);
print(y);
index = + index 1;

if ( == index 500)

break;
}

Of course, this is a slow way of doing things…and it’s performance intensive since we loop through each character…

The easiest and simplest way is to just do this:

string file = fileOpen(“./test.jrl”);

printLine( file);

 

This will automatically grab the file and print the contents of it on the screen.

I hope this instruction has been education. Let me know if you have problems in the comments below!

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge

 

Cybrary|0P3N

Is Linux Worth Learning in 2020?
Views: 295 / December 14, 2019
How do I Get MTA Certified?
Views: 893 / December 12, 2019
How much does your PAM software really cost?
Views: 1344 / December 10, 2019
How Do I Get into Android Development?
Views: 1723 / December 8, 2019

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel