... Streams and File Descriptors 11 7 11 8 File and Directory Maintenance 11 8 chmod chown x 11 8 11 9 Contents unlink, link, and symlink mkdir and rmdir chdir and getcwd Scanning Directories opendir ... 223 223 225 226 227 Try It Out—-Colors Redefining Colors Pads 229 230 230 Try It Out—Using a Pad The CD Collection Application Try It Out—A New CD Collection Application... 509 509 510 510 511 ... 19 0 19 1 19 1 19 2 19 5 19 8 200 200 202 204 204 Contents Chapter 6: Managing Text-Based Screens with curses Compiling with curses Concepts Try It Out—A Simple... 94 95 96 96 97 98 10 0
Ngày tải lên: 09/08/2014, 14:21
... these scripts in conjunction with the dot command, as in the fol- lowing sample session: $ . ./classic_set classic> echo $version classic classic> . latest_set latest version> echo $version ... dot command works a little like the #include directive in C or C+ +. Though it doesn’t literally include the script, it does execute the command in the current context, so you can use it to incor- ... It’s always good practice to supply an exit code. In shell script programming, exit code 0 is success and codes 1 through 125 inclusive are error codes that can be used by scripts. The remaining
Ngày tải lên: 09/08/2014, 14:21
Beginning Linux Programming Third Edition phần 4 pps
... initialized, which is generally a good thing. The variable current_cat will be used to record the catalog number of the current CD. static char current_cd[MAX_STRING] = “\0”; static char current_cat[MAX_STRING]; ... This could cause a problem if the program is run by two users in the same directory. const char *title_file = “title.cdb”; const char *tracks_file = “tracks.cdb”; const char *temp_file = “cdb.tmp”; ... variable current_cd is used to store the current CD title with which we are working. It’s initialized so that the first character is null to indicate “no CD selected.” The \0 is strictly unnecessary,
Ngày tải lên: 09/08/2014, 14:21
Beginning Linux Programming Third Edition phần 6 pps
... show_all_lists {prcc .c 1070} usage {prcc .c 59} printf {} display_list {prcc .c 10 56} maketag {prcc .c 487} show_all_lists {prcc .c 1070} main {prcc .c 70} usage {prcc .c 59} main {prcc .c 70} This... ... /usr/src/redhat/BUILD + cd myapp-1.0 + LANG =C + export LANG + make gcc -g -Wall -ansi -c -o main.o main .c gcc -g -Wall -ansi -c -o 2.o 2 .c ar rv mylib.a 2.o a - 2.o gcc -g -Wall -ansi -c -o 3.o 3 .c ... different... make a call to it It sounds complicated, but it really isn’t Here’s a sample 19 20 21 22 display_list {prcc .c 10 56} show_all_lists {prcc .c 1070} exit {} main {prcc .c 70} 437 Chapter 10 23
Ngày tải lên: 09/08/2014, 14:21
Beginning Linux Programming Third Edition phần 7 pot
... interested, you can simply pass NULL. If cancel requests are accepted, there is a second level of control the thread can take, the cancel type, which is set with pthread_setcanceltype. 498 Chapter 12 ... that it be canceled. On the receiving end of the cancel request, things are slightly more complicated, but not much. A thread can set its cancel state using pthread_setcancelstate. #include <pthread.h> ... that some blocked calls such as sleep do allow cancellation to take place. To be on the safe side, you may wish to add some pthread_testcancel calls in code that you expect to be canceled. 499
Ngày tải lên: 09/08/2014, 14:21
Beginning Linux Programming Third Edition phần 8 ppsx
... for incoming connections. The server can accept them using the system call accept. When the server calls accept, a new socket is created that is distinct from the named socket. This new socket ... a connection. client_len = sizeof(client_address); client_sockfd = accept(server_sockfd, (struct sockaddr *)&client_address, &client_len); 6. Read and write to client on client_sockfd. ... introduced a new communication tool, the socket interface, which is an extension of the concept of a pipe, which we covered in Chapter 13. Socket interfaces are avail- able on Linux. You can use sockets
Ngày tải lên: 09/08/2014, 14:21
Beginning Linux Programming Third Edition phần 9 pdf
... compile this application. all: app app: app_mysql .c callbacks .c interface .c main .c app_gnome.h app_mysql.h gcc -o app -I/usr/include/mysql app_mysql .c callbacks .c interface .c main .c - lmysqlclient ... *artist_const; const gchar *title_const; const gchar *catalogue_const; gchar artist[200]; gchar title[200]; gchar catalogue[200]; gint *cd_id; if (response == GTK_RESPONSE_ACCEPT) { artist_const ... struct current_cd_st cd; struct current_tracks_st ct; gint res1, res2, res3; gchar track_title[110]; const gchar *search_string_const; gchar search_string[200]; gchar search_text[200]; gint i = 0,
Ngày tải lên: 09/08/2014, 14:21
Beginning Linux Programming Third Edition phần 10 docx
... address can be determined from /proc/pci, provided you have a PCI or AGP adapter; it is the prefetchable location listed there: $ cat /proc/pci PCI devices found: Bus 1, device 0, function 0: VGA compatible ... access_ok call was not included in schar, for example. Often the check is omitted by mistake, and the x_user functions therefore include the check. The return value is 0 if the copy was completed ... machines... shared while local variables are different copies: pid = 909 : global = 0xc18005fc, local = 0xc08d3f 2c pid = 910 : global = 0xc18005fc, local = 0xc098df 2c While having local variables residing
Ngày tải lên: 09/08/2014, 14:21
Unix Shell Programming Third Edition phần 1 doc
... The shift Command Exercises Chapter 8. Decisions, Decisions Exit Status The test Command The else Construct The exit Command The elif Construct The case Command ... Pipeline Associates, Inc., a Unix consulting firm, where he was the Vice President. They coauthored Exploring the Unix System, Unix System Security, Topics in C Programming, and Unix Shell Programming. ... Other Ways to Access Your History Functions Integer Arithmetic The alias Command Arrays Job Control The Restricted Shell rsh Miscellaneous Features Compatibility
Ngày tải lên: 13/08/2014, 15:21
Unix Shell Programming Third Edition phần 2 pot
... where each argument starts and ends. These characters are collectively called whitespace characters, and are the space character, the horizontal tab character, and the end-of-line character, known ... scans the command line looking for redirection characters, it also looks for the pipe character |. For each such character that it finds, it connects the standard output from the command preceding ... shell's responsibility to take care of input and output redirection on the command line. It scans the command line for the occurrence of the special redirection characters <, >, or >>
Ngày tải lên: 13/08/2014, 15:21
Unix Shell Programming Third Edition phần 3 docx
... characters of each line of /etc/passwd up to the colon are the username). This can't be done directly through an option to uniq, but can be accomplished indirectly by using cut to extract ... except that each output line gets preceded by a count of the number of times the line occurred in the input. $ sort names | uniq ? ?c Count line occurrences 1 Charlie 1 Emanuel 1 Fred 1 Lucy ... single character * to x This means that the shell did the filename substitution when executing the echo command In fact, the precise sequence of steps that occurred when echo $x was executed
Ngày tải lên: 13/08/2014, 15:21
Unix Shell Programming Third Edition phần 4 pptx
... commands between then and fi are executed; in this case, the single echo command is executed If the exit status is nonzero, the echo command is skipped It's good programming practice to enclose ... some commands can vary from one Unix version to the next, but success is always... arguments because the shell ate up the four spaces in blanks In the second case, test got one argument consisting ... 14: 57 $ echo $? Print exit status of last command (grep) 0 grep "succeeded" $ who | grep fred $ echo $? 1 grep "failed" $ echo $? 0 Exit status of last echo $ Note that the numeric result of
Ngày tải lên: 13/08/2014, 15:21
Unix Shell Programming Third Edition phần 5 pptx
... command t do command command done command t is executed and its exit status tested. If it's zero, the commands enclosed between the do and done are executed. Then command t is executed ... a b c $ args 'a b' c Number of arguments passed is 2 a b c $ The while Command The second type of looping command to be described in this chapter is the while. The format of this command ... we'll have it check only once every minute To do this, you have to know about a command called sleep that suspends execution of a program for a specified number of seconds So the Unix command (this
Ngày tải lên: 13/08/2014, 15:21
Tài liệu Practical C Programming P2 pptx
... Turbo C+ + under MS-DOS Borland International makes a low-cost MS-DOS C+ + compiler called Turbo C+ +. This compiler will compile both C and C+ + code. We will describe only how to compile C code. ... their offerings is a C compiler called gcc. To compile a program using the gcc compiler use the following command line: % gcc -g -Wall -ohello hello .c The additional switch -Wall turns on the ... is: C: > bcc -ml -v -N -P -w -ehello hello .c The command-line options are the same for both Turbo C+ + and Borland C+ +. 2.3.3.5 Microsoft Visual C+ + Microsoft Visual C+ + is another C+ + /C compiler...
Ngày tải lên: 12/12/2013, 22:15
Tài liệu Practical C Programming P1 doc
... Foundation's gcc compiler. For MS-DOS/Windows users, instructions are included for Borland C+ +, Turbo C+ +, and Microsoft Visual C+ +. (These compilers compile both C and C+ + code.) The book ... and Functions Scope and Class Functions Functions with No Parameters Structured Programming Recursion Answers Programming Exercises 10. C Preprocessor #define Statement Conditional ... Organized Chapter by Chapter Notes on the Third Edition Font Conventions Obtaining Source Code Comments and Questions Acknowledgments Acknowledgments to the Third Edition I. Basics 1....
Ngày tải lên: 12/12/2013, 22:15
The C programming Langguage 2nd Edition
... used in comparisons with other characters. Certain characters can be represented in character and string constants by escape sequences like \n (newline); these sequences look like two characters, ... the other is specifically called for. For instance, consider the function squeeze(s ,c) , which removes all occurrences of the character c from the string s. /* squeeze: delete all c from s */ ... A character constant is an integer, written as one character within single quotes, such as 'x'. The value of a character constant is the numeric value of the character in the machine's character...
Ngày tải lên: 16/08/2012, 11:09
Practical Database Programming With Visual C#.NET- P6
... OleDbCommand accCommand = new OleDbCommand(); SelectionForm selForm = new SelectionForm(); OleDbDataReader accDataReader; accCommand.Connection = accConnection; accCommand.CommandType = CommandType.Text; ... "Data Source =C: \\database\\Access\\CSE_DEPT.accdb;"; accConnection = new OleDbConnection(strConnectionString); try { accConnection.Open(); } catch (OleDbException e) { MessageBox.Show("Access ... DataTable accDataTable = new DataTable(); OleDbCommand accCommand = new OleDbCommand(); SelectionForm selForm = new SelectionForm(); accCommand.Connection = accConnection; accCommand.CommandType...
Ngày tải lên: 17/10/2013, 19:15
Practical Database Programming With Visual C#.NET- P7
... string.Empty; DataRow rowFaculty; accCmdFaculty.Connection = logForm.accConnection; accCmdFaculty.CommandType = CommandType.Text; accCmdFaculty.CommandText = strFaculty; accCmdFaculty.Parameters.Add("@Param1", ... MTC-336 J33486 Steve Johnson MTC-118 K69880 Jenney King MTC-324 course_id faculty_id classroom CSC-131A A52990 TC-109 CSC-13 1C A52990 TC-109 CSC-132A J33486 TC-303 CSC-132B B78880 TC-302 CSC-230 ... OleDbType.Char).Value = ComboName.Text; FacultyDataAdapter.SelectCommand = accCmdFaculty; FacultyDataAdapter.Fill(accFacultyTable); if (accFacultyTable.Rows.Count > 0) { rowFaculty = accFacultyTable.Rows[0];...
Ngày tải lên: 20/10/2013, 11:15
Practical Database Programming With Visual C#.NET- P8
... oraDataReader.Close(); } A B C D OracleSelectRTObject.LogInForm cmdReadLogIn_Click() Figure 5.164 Coding for the ReadLogIn button Click method. private void cmdCancel_Click(object sender, ... namespace System.Data.SqlClient to the namespace declaration section on this SP form code window. The only difference is the codes for the Select button Click method, cmdSelect_Click(). Don ’ t copy ... objects or methods to use it to access the global connection object oraConnection created in this form object. You can test these pieces of coding by running the project if you like. A SelectionForm...
Ngày tải lên: 20/10/2013, 11:15
Bạn có muốn tìm thêm với từ khóa: