Skip to Main Content
Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals
book

Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals

by James C Foster
April 2005
Intermediate to advanced content levelIntermediate to advanced
700 pages
20h 39m
English
Syngress
Content preview from Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals
header file is required in order to use the mode values passed to the open function.
Example 6.17 demonstrates use of the open family of functions to create, write to, and
close a file.
Example 6.17 File Handling with Open(), Read(), Write(), and Close() Functions
(file2.c)
1 /*
2 * file2.c
3 *
4 * Win32 open function example
5 */
6
7
#include <stdio.h>
8 #include <io.h> // required for open, write, close functions
9 #include <fcntl.h> // required for open modes (_O_CREAT, etc)
10
11
int
12 main(void)
13 {
14 int ret = 0;
15 int fd = 0;
16
17
fd = open("test.txt", _O_CREAT | _O_WRONLY);
18 if(fd < 0)
19 {
20 printf("open() failed.\r\n");
21 return(1);
22 }
23
24
ret = write(fd, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

32/64-Bit 80x86 Assembly Language Architecture

32/64-Bit 80x86 Assembly Language Architecture

James Leiterman

Publisher Resources

ISBN: 9781597490054