Ready to Start Your Career?

Reading and Outputting from a File in Juliar

Rattar 's profile image

By: Rattar

May 3, 2017

juliar-file-outputThis 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 stringif - if conditionwhile - while conditionfileopen - 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!
Schedule Demo