*Learned some basic C programming etiquette and vocabulary.
#include <stdio.h>
$ gcc -o hello hello.c
$ ./hello
There are things called file pointers. They show where things will display to/from.
Some commands:
There are two ways to approach problems that you need to solve in C.
There are ways of specifying formats using printf:
Anything you see in the format of _x_ _ indicates that it is a hexadecimal value. For example:
hexadecimal | octal | unsigned decimal | signed decimal | unsigned binary |
---|---|---|---|---|
0 | 00 | 00 | +0* | 0000 |
1 | 01 | 01 | +1 | 0001 |
2 | 02 | 02 | +2 | 0010 |
3 | 03 | 03 | +3 | 0011 |
4 | 04 | 04 | +4 | 0100 |
5 | 05 | 05 | +5 | 0101 |
6 | 06 | 06 | +6 | 0110 |
7 | 07 | 07 | +7 | 0111 |
8 | 10 | 08 | -8 | 1000 |
9 | 11 | 09 | -7 | 1001 |
A | 12 | 10 | -6 | 1010 |
B | 13 | 11 | -5 | 1011 |
C | 14 | 12 | -4 | 1100 |
D | 15 | 13 | -3 | 1101 |
E | 16 | 14 | -2 | 1110 |
F | 17 | 15 | -1 | 1111 |
*obviously zero has no sign, this is just how the computer handles it.
A lot of your regular punctuation are actually operators in C. There are two main forms:
Here is an example of the use of arrays in code form:
1 #include <stdio.h> 2 #include <stdlib.h> 3 int main () 4 { 5 int i, *scores, sum=0, total; 6 float average; 7 printf("How big is the array?\n"); 8 scanf("%d", &total); 9 scores=(int *)malloc(sizeof(int)*total); 10 for (i=0; i<total; i++) 11 { 12 printf("enter test score %d/%d: ",(i+1), total); 13 scanf("%d", (scores+i)); 14 } 15 for (i=0; i<total; i++) 16 sum= sum + *(scores+i); 17 average =(float)sum/(float)total; 18 printf("average is: %3.2f\n", average); 19 return(0); 20 }
*so, if you want your output to have all sorts of “organization” and “readability” and other such nonsense spewed by bureaucratic hippies (communists), there is a variety of tools you can utilize in the C/C++ programming system, published by Nintendo.
~$ printf("%4hhd\n", a);
4 5 6 7 8 9
etc…
~$ printf("%.4hhd\n", a);
00004 00005 00006 00007 00008 00009
etc…
*Tuesday
-$ tail -f var/log/daemon.log
-Thursday
*We've continued working on the Virtual Machine project. We got onto our new machines and began installing important extras, like vim and Xen.
$ apt-get install package
or
$ apt-cache search package
versus:
$ aptitude search package
or
$ aptitude install package
-Some other formats of aptitude are:
$ aptitude install vim
$ dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen
#The loopback network interface auto lo iface lo inet loopback iface eth0 inet manual auto xenbr0 iface xenbr0 inet dhcp bridge_ports eth0
XENDOMAINS_RESTORE=false XENDOMAINS_SAVE=""
xen-create-image --verbose --hostname=test --dhcp --vcpus=2 --pygrub --dist=wheezy --force
$ useradd horus $ passwd horus
~$ dump -f /home/temp/trash badfile.c
~$mkdir home/temp/trash|dump -f /home/temp/trash badfile.c