File: fwriter.cpp

package info (click to toggle)
icomlib 1.0.1-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,652 kB
  • ctags: 1,363
  • sloc: cpp: 4,849; makefile: 536; sh: 181; ansic: 145
file content (48 lines) | stat: -rw-r--r-- 691 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <unistd.h>

struct foostruc {
	int elmo1; int elmo2; int elmo3;
	char elmo4[128]; char elmo5[32];
	float elmo6;
} elmo101;


class obj1 {
	public :
		obj1 ();
		~obj1();

	private:
		int foo1;
		char *foo2;
		float foo3;
};

obj1 :: obj1()
{
	elmo101.elmo1=10;
	elmo101.elmo2=21;
	elmo101.elmo3=32;
	strcpy(elmo101.elmo4, "elmo4 variable");
	strcpy(elmo101.elmo5, "elmo5 var");
	elmo101.elmo6=43.223;
}

obj1 :: ~obj1()
{
	fprintf(stderr, "destroying \n");
}

void main()
{
	obj1 elmofoo();

	int fd = open("./output.dat", O_CREAT | O_WRONLY);
	write(fd, &elmo101, sizeof(&elmo101));
	close(fd);
}