This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
blog:spring2016:mmalik1:journal [2016/02/22 17:15] – mmalik1 | blog:spring2016:mmalik1:journal [2016/05/03 15:56] (current) – mmalik1 | ||
---|---|---|---|
Line 188: | Line 188: | ||
If the -v argument was used, the program will output what the permissions are changed to. I accomplished this using the stat system call, which takes in a char * which is the path of the file you want to view information on and a struct stat *, which is where all of the information is put into. | If the -v argument was used, the program will output what the permissions are changed to. I accomplished this using the stat system call, which takes in a char * which is the path of the file you want to view information on and a struct stat *, which is where all of the information is put into. | ||
+ | |||
+ | ====March 7, 2016==== | ||
+ | |||
+ | Stuff. | ||
+ | |||
+ | ====March 15, 2016==== | ||
+ | |||
+ | Today we are continuing to learn about sockets in C. Sockets are used for cross machine communication over some network. So, for example, if we want computer A to send some sort of message to computer B, sockets would be a good way to go. | ||
+ | |||
+ | The first socket program we will be writing is a program which will communicate with a time server and get the current time. | ||
+ | |||
+ | We successfully wrote the server side program. It was cool. | ||
+ | |||
+ | ====March 17, 2015==== | ||
+ | |||
+ | Today we are writing a program called ipaddr.c. Essentially this program will look up the ip addresses of all network interfaces. This program would include the following headers. | ||
+ | |||
+ | * stdio.h | ||
+ | * stdlib.h | ||
+ | * string.h | ||
+ | * sys/types.h | ||
+ | * sys/ | ||
+ | * ifaddrs.h | ||
+ | * arpa/inet.h | ||
+ | |||
+ | One of the functions we used in the program is getifaddrs(struct ifaddrs **). This function will put into the double pointer information regarding the local machine network interfaces. The struct that this function actually returns is a linked list, where each struct ifaddrs will point to another struct ifaddrs, and so on until we reach NULL. More can be found on the man page. | ||
+ | |||
+ | A lot of this program will revolve around looping through the linked list and pulling information about each network interface. Certain information can then be displayed. | ||
+ | |||
+ | Something cool I learned today. Using calloc will clear the allocated memory with zeros, whereas with malloc, all it would do is return a pointer to some allocated memory without clearing it. So, if you use malloc and find a bunch of weird characters in that region of memory, try using calloc instead. | ||
+ | |||
+ | ====March 22, 2016==== | ||
+ | |||
+ | Today we began writing a program which will act as a client for the time server we created two classes ago. | ||
+ | |||
+ | Well that didn't take very long. It's already done. Here are the header files we used. | ||
+ | |||
+ | * stdio.h | ||
+ | * stdlib.h | ||
+ | * strings.h | ||
+ | * sys/types.h | ||
+ | * sys/ | ||
+ | * netinet/ | ||
+ | * netdb.h | ||
+ | * unistd.h | ||
+ | |||
+ | That was the end of it. | ||
+ | |||
+ | ====April 5, 2016==== | ||
+ | |||
+ | We are about to learn about pipes. I have no idea what to expect so hopefully this will be a fun and exciting experience. | ||
+ | |||
+ | So we are currently looking at the pipe man page and the information in this page is a lot. Pipes are very cool. | ||
+ | |||
+ | We also talked about FIFO, or LILO. FIFO stands for "first in first out" whereas LILO stands for "last in last out". These are also known as queues. We learned about queues in data structures. Essentially, | ||
+ | |||
+ | We also talked about LIFO and FILO. LIFO stands for "last in first out" and FILO stands for "first in last out". These terms are associated with a data structure known as a stack. In a stack, the first pieces of data put into the stack are the last ones to come out. This can be viewed as similar to a stack of paper, where only the top sheet of paper (or the last sheet of paper put into the stack) is visible first. To get to the first sheet of paper put into the stack, all the other sheets of paper must be taken out first. Therefore, it is last to come out of the stack. | ||
+ | |||
+ | We just made a program which uses pipes. It's really cool. The program takes in one input, which is a string. Basically, this program will take that string and pipe it from a child process to the main process or something like that. | ||
+ | |||
+ | ====April 12, 2016==== | ||
+ | |||
+ | Today we are learning about shared memory. Essentially, | ||
+ | |||
+ | Using this idea of shared memory, we have created several programs. The first program simply uses shared memory to access different chars and stuff like that. Everyone in the class had read and write access to a certain file and it was pretty crazy. | ||
+ | |||
+ | The next program we began to create was a (really messy) instant messaging program. Basically, using shared memory, we were able to share messages back and forth. | ||
+ | |||
+ | ====April 21, 2016==== | ||
+ | |||
+ | Today we played around with ncurses. Ncurses is a C library which allows the user to play around with the terminal and basically do really cool things with it, including make games. This is how games such as tetris-bsd or hangman are created. Using basic printf statements and stuff like that would take ages to create a game of that calibre, so this library does the hard stuff for us. | ||
+ | |||
+ | ====April 26, 2016==== | ||
+ | |||
+ | Today we are playing around with ncurses more. We are working on creating a program which will logically turn one screen into multiple screens, so that we can manipulate it in cool ways. | ||
+ | |||
+ | So far we have made it so that a bunch of dots fill up the screen in three different parts of the screen. A random color will appear in each row and bold dots will show up in the second part of the screen. | ||
+ | |||
+ | We made this neat program with ncurses which takes in user input to display different neat things to the screen. It's cool. | ||
+ | |||
+ | ====May 3, 2016==== | ||
+ | |||
+ | I missed class on Thursday unfortunately because yolo. I guess we started doing pacman like things so yea. We are continuing that today. | ||
+ | |||
+ |