How to Convert Your Running Code Into a Pdf File

by shoaibmirza in Workshop > Science

1119 Views, 2 Favorites, 0 Comments

How to Convert Your Running Code Into a Pdf File

images.jpeg

This will teach you how to convert a running code in terminal into a pdf with help of FileZilla.

​Introduction

The following instructions provides step by step guidance on how to turn your running code written in C++ into a PDF file. C++ is a programming language which is used for developing operating systems, browsers, games and much more. It is important to learn this because most of the times a Programmer would be asked to share their work with their colleagues and clients. So, just by learning this you will be able to send your codes in pdf format which would look professional, and the other person would not need to check if by themselves what does the program do

Disclaimer!

These instructions set requires the use of an application called Terminal and File-Zilla. Terminal can be found in most MacBook's. You can see if you have a terminal in your Mac just by pressing command and space key and search from there. File-zilla should be downloaded separately here is the link for it: https://filezilla-project.org. These instructions are exclusively for MacOS.

Instructions

Start-Terminal-on-macbook-1.jpg

The first step is to log in to a Unix server. This is done in Terminal, whether you plan to run Nedit (to edit a program) or mate-terminal (to compile, debug/test, or script your program), you are going to be connecting to the same account on the same machine: for example, @wasm.cdm.depaul.edu You'll need to know both your login id (or login name) and your password. When your account is first created (by IT when you register), they use your Student Portal login id.

Screen Shot 2021-02-06 at 7.40.53 PM.png

The next step is to log in to the Unix server which you just made. So, we open Terminal and log in, the system will show if you have successfully logged in to a correct server. Also, a sidenote when you are typing your Password in Terminal it would not be visible because of Security reasons, if you do not see your Password do not panic it is supposed to do that.

fz3_osx_main.png

Now we need to open File-zilla which we had downloaded before. File-zilla is a software application that saves our C++ projects that we made. We need to type the same username and password which we used for Unix server. This is important because you want the system to know where you would like to save and run your code.

Annotated_main_window_preview.png

This step is a bit tricky and can be easy to mess up because we are supposed to open two things at once and are copying and pasting at same time. First open the program you would like to share on File-zilla. Now open File-Zilla drag and drop the program you opened. After doing this your program has now been saved in the secure server of Unix.

filezilla-trouble-uploading.png

The job of File-Zilla is done now. This application only helps the user to share and save a particular program at a time. If you have 2 three program you would have to name each of the programs so that the system does not mix it up with other files.

Screen Shot 2021-02-06 at 7.48.42 PM.png

The next step is to script the program. A scripting or script language is a programming language for a special run-time environment that automates the execution of tasks; the tasks could alternatively be executed one-by-one by a human operator. Open terminal again and now type script. This will have a $ sign ahead of it which means you are in right path

After it says script started, now type pwd this means print working directory. Then type cat progname.info (this only works if you have an info file on your C++ file). (this is a sample of my code in pdf)

Now we are running our program in terminal to see if it is working. This is simultaneously recording your work. This is good because when converting in PDF it will be showing a running program.

Now type cat progname.cpp then CPP progname. Now we are running the program in order to do that type ./progname.out (this command will run the program; you can run the program as many times you like just typing the command repeatedly).

This Is My Example on How the Output Looks in Pdf If You Just Follow the Commands on Terminal Using the Image Form Step 8

Screen Shot 2021-02-06 at 7.01.31 PM.png

The last step is to type exit, this will end the script. Now to turn this into PDF just type script-print Last-First-progname. Your program is now successfully turned into a PDF file. Now you can exit Terminal and open File-zilla you should be able find a file of the program and have .pdf at end.

Conclusion

Congratulations! You have now successfully converted your C++ program into a PDF. You have learnt how to use Terminal; you are now familiar with Linux systems. Now you know the commands to script a program in terminal. You now know how to use File-Zilla. This can be tedious to do in the beginning but as you get experienced this doesn't even take 2 minutes to complete.

It is also vital to maintain the organization of folders and subfolders in File-Zilla because it can be easy to mix the files and you can even mess your program in process. So be very careful of dragging and dropping your codes.

This set has provided with step-by-step guidance for Installing File-Zilla, using Terminal and converting your codes to PDF in 10 steps. Enjoy programming!

Additional links for Computer science

https://stackoverflow.com this is a great website if you have any questions regarding your codes.