sunlightlj的专栏

Only Dead Fish Swim with the Flow

What is the computer program?

  • A computer program, also called software, is a way to tell a computer what to do.
  • FunctionMost languages allow you to create functions of some sort. Functions let you chop up a long program into named sections so that the sections can be reused throughout the program. Functions accept parameters and return a result.

 
  • Every library consists of two parts: a header file and the actual code file. The header file, normally denoted by a .h suffix, contains information about the library that programs using it need to know. In general, the header file contains constants and types, along with prototypes for functions available in the library.
  • printf - prints formatted output to stdout
  • scanf - reads formatted input from stdin
  • puts - prints a string to stdout
  • gets - reads a string from stdin
  • putc - prints a character to stdout
  • getc, getchar - reads a character from stdin
  • fopen - opens a text file
  • fclose - closes a text file
  • feof - detects end-of-file marker in a file
  • fprintf - prints formatted output to a file
  • fscanf - reads formatted input from a file
  • fputs - prints a string to a file
  • fgets - reads a string from a file
  • fputc - prints a character to a file
  • fgetc - reads a character from a file



C uses pointers in three different ways:

  • C uses pointers to create dynamic data structures -- data structures built up from blocks of memory allocated from the heap at run-time.

  • C uses pointers to handle variable parameters passed to functions.

  • Pointers in C provide an alternative way to access information stored in arrays. Pointer techniques are especially valuable when you work with strings. There is an intimate link between arrays and pointers in C.

The text editor is a programmer's intimate link to the computer


A process may start many threads or other processes, but a thread cannot start a process.


You can think of the word static as meaning "no matter how many objects are made, there will be only one of these."

Network

The following is an example of a URL which addresses the Java Web site hosted by Sun Microsystems:

As in the previous diagram, a URL has two main components:
  • Protocol identifier
  • Resource name

The resource name contains one or more of the components listed in the following table:

Host Name The name of the machine on which the resource lives.
Filename The pathname to the file on the machine.
Port Number The port number to which to connect (typically optional).
Reference A reference to a named anchor within a resource that usually identifies a specific location within a file (typically optional).
import java.net.*;
import java.io.*;

public class ParseURL {
public static void main(String[] args) throws Exception {
URL aURL = new URL("http://java.sun.com:80/docs/books/"
+ "tutorial/index.html#DOWNLOADING");
System.out.println("protocol = " + aURL.getProtocol());
System.out.println("host = " + aURL.getHost());
System.out.println("filename = " + aURL.getFile());
System.out.println("port = " + aURL.getPort());
System.out.println("ref = " + aURL.getRef());
}
}
Here's the output displayed by the program:
protocol = http
host = java.sun.com
filename = /docs/books/tutorial/index.html
port = 80
ref = DOWNLOADING
阅读更多
下一篇一些哲理
想对作者说点什么? 我来说一句

wireshark抓包实验之TCP

2017年10月24日 609KB 下载

没有更多推荐了,返回首页

关闭
关闭