Ticket #3231: test3231.cpp

File test3231.cpp, 1.4 KB (added by darkwyrm, 13 years ago)

Code which reproduces the current state of the bug - hrev41787

Line 
1#include <Entry.h>
2#include <File.h>
3#include <String.h>
4#include <stdio.h>
5
6BString projectString =
7 "NAME=testproject\n"
8 "TARGETNAME=testproject\n"
9 "PLATFORM=HaikuGCC4\n"
10 "SCM=none\n"
11 "GROUP=Source Files\n"
12 "EXPANDGROUP=yes\n"
13 "SOURCEFILE=main.cpp\n"
14 "LOCALINCLUDE=\n"
15 "SYSTEMINCLUDE=/boot/develop/headers/be\n"
16 "SYSTEMINCLUDE=/boot/develop/headers/cpp\n"
17 "SYSTEMINCLUDE=/boot/develop/headers/posix\n"
18 "SYSTEMINCLUDE=/boot/home/config/include\n"
19 "LIBRARY=/boot/develop/lib/x86/libroot.so\n"
20 "LIBRARY=/boot/develop/lib/x86/libbe.so\n"
21 "LIBRARY=/boot/develop/lib/x86/libsupc++.so\n"
22 "LIBRARY=/boot/system/lib/libsupc++.so\n"
23 "RUNARGS=\n"
24 "CCDEBUG=no\n"
25 "CCPROFILE=no\n"
26 "CCOPSIZE=no\n"
27 "CCOPLEVEL=0\n"
28 "CCTARGETTYPE=0\n"
29 "CCEXTRA=\n"
30 "LDEXTRA=\n";
31
32BString projectFileType = "text/x-vnd.dw-Paladin.Project";
33
34int
35main(void)
36{
37 //BEntry("testproject.pld").Remove();
38 BFile file("testproject.pld", B_CREATE_FILE | B_READ_WRITE);
39
40 int32 out = file.Write(projectString.String(), projectString.Length());
41 printf("Size of project data written: %ld\n", projectString.Length());
42 printf("Bytes written to test project: %ld\n", out);
43
44 out = file.WriteAttrString("BEOS:TYPE", &projectFileType);
45 printf("WriteAttrString() returned error number %ld\n", out);
46
47 BString type;
48 file.ReadAttrString("BEOS:TYPE", &type);
49 printf("Type read from file: %s\n", type.String());
50
51 file.Unset();
52 return 0;
53}