![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
We have a special case where we write documents out by appending data to the end of the file. We do this in our Unix environments by using the C calls with open, and write. I have tried to make this happen in D3NT, which I have heard works. I am on 7.4.7, so that might be an issue (if this only works in 7.5.x). Something simple like: fl.nme = 'c:\temp\test.dat' fd = %open(fl.nme,o$rdwr) tbl = 'Single Test Line ':char(10) rc=%write(fd, tbl, len(tbl) ) %close( fd ) Where I have set o$rdwr to different values. Although I don't know where to find the values of this variable for windows environment. I'd like the o$rdwr to really be o$append. |
#3
| |||
| |||
|
|
We have a special case where we write documents out by appending data to the end of the file. We do this in our Unix environments by using the C calls with open, and write. I have tried to make this happen in D3NT, which I have heard works. I am on 7.4.7, so that might be an issue (if this only works in 7.5.x). Something simple like: fl.nme = 'c:\temp\test.dat' fd = %open(fl.nme,o$rdwr) tbl = 'Single Test Line ':char(10) rc=%write(fd, tbl, len(tbl) ) %close( fd ) Where I have set o$rdwr to different values. Although I don't know where to find the values of this variable for windows environment. I'd like the o$rdwr to really be o$append. |
#4
| |||
| |||
|
|
We have a special case where we write documents out by appending data to the end of the file. We do this in our Unix environments by using the C calls with open, and write. I have tried to make this happen in D3NT, which I have heard works. I am on 7.4.7, so that might be an issue (if this only works in 7.5.x). Something simple like: fl.nme = 'c:\temp\test.dat' fd = %open(fl.nme,o$rdwr) tbl = 'Single Test Line ':char(10) rc=%write(fd, tbl, len(tbl) ) %close( fd ) Where I have set o$rdwr to different values. Although I don't know where to find the values of this variable for windows environment. I'd like the o$rdwr to really be o$append. |
#5
| |||||
| |||||
|
|
Hi You have run into one of the best ideas with the worst documentation/implementation in D3. Some genius a few years back removed the NT add in file and buried them in a file called Unix.h. |
|
You need 001 $OPTIONS EXT 002 INCLUDE DM,BP,UNIX.H FCNTL.H;* Yes this does apply to NT |
|
Then comes the tricky bit, not all the commands apply in NT. You can deduce it from the docs in most cases however be cautious and test little bits at a time. |
|
I had it working in 7.4.4 so good luck. Make sure you have the correct COMPILE options this does not work with the BASIC verb. Peter McMurray |
) still use the ap command from *nix.|
"Jt" <jtillia (AT) acspg (DOT) com> wrote in message news:12nrekbd2ju1c6c (AT) corp (DOT) supernews.com... We have a special case where we write documents out by appending data to the end of the file. We do this in our Unix environments by using the C calls with open, and write. I have tried to make this happen in D3NT, which I have heard works. I am on 7.4.7, so that might be an issue (if this only works in 7.5.x). Something simple like: fl.nme = 'c:\temp\test.dat' fd = %open(fl.nme,o$rdwr) tbl = 'Single Test Line ':char(10) rc=%write(fd, tbl, len(tbl) ) %close( fd ) Where I have set o$rdwr to different values. Although I don't know where to find the values of this variable for windows environment. I'd like the o$rdwr to really be o$append. |
#6
| |||
| |||
|
|
"Excalibur" wrote: Hi You have run into one of the best ideas with the worst documentation/implementation in D3. Some genius a few years back removed the NT add in file and buried them in a file called Unix.h. What "NT add in file"? My C functions have always used Unix.h. Here is a segment from one of my progs. $options ext cfunction socket.builtin include dm,bp,includes sysid.inc include dm,bp,unix.h socket.h include dm,bp,unix.h fcntl.h include dm,bp,unix.h errno.h include dm,bp,unix.h signal.h You need 001 $OPTIONS EXT 002 INCLUDE DM,BP,UNIX.H FCNTL.H;* Yes this does apply to NT I understand the confusion and agree that it's a paradox, but would you prefer to have to modify your code depending on the deployment platform? The fcntl.h code includes proper values for all platforms, *nix and nt. The code being discussed here should work with just a recompile between *nix and NT (except that Jesse is hardcoding values, see below). If the location of the include items change between platforms, that wouldn't be the case and people would get bent all out of shape. Then comes the tricky bit, not all the commands apply in NT. You can deduce it from the docs in most cases however be cautious and test little bits at a time. As I recall there are very few exceptions and they all relate to sockets, not file IO. %recv vs %read, %send vs %write, and %closesocket vs %close. Simple code gets around this - it's worked for so long without error that I forgot how it works anymore. I had it working in 7.4.4 so good luck. Make sure you have the correct COMPILE options this does not work with the BASIC verb. Peter McMurray Despite my "please check again" inquiries with RD, I've been re-re-assured that the only difference between BASIC and COMPILE is case sensitivity. I will trust your observation however and suggest that anyone who cares should file this with RD as an action item. About Options, I think Flash-compiling is a requirement for these functions. Hmmm - yes, the included code is all in caps. If your code is in lower case and you use BASIC then those vars will be unassigned. When you use Compile, your o$whatever is the same variable as their O$WHATEVER and everything will work. In fact, if you look at the code that Dave posted, O$RDWR is in caps. I'll bet a donut that's there because the author liked to use the Basic verb and they did some head scratching when o$rdwr didn't work with the rest of their lower case code. :^D On the other side. Since Compile has been with us for over 10 years now, why would anyone on D3 still be using the Basic verb to compile? Flame jacket on helmet on rosey glasses on just took another Dilligaff pill (Do I look like I give a flying f_____?) I know I know, it's the same reason some people (and you know who you are ) still use the ap command from *nix.BTW, Jesse - don't hardcode the values for o$rdwr or o$append. They're already in that include item that Peter has pointed you to. Good luck. T "Jt" <jtillia (AT) acspg (DOT) com> wrote in message news:12nrekbd2ju1c6c (AT) corp (DOT) supernews.com... We have a special case where we write documents out by appending data to the end of the file. We do this in our Unix environments by using the C calls with open, and write. I have tried to make this happen in D3NT, which I have heard works. I am on 7.4.7, so that might be an issue (if this only works in 7.5.x). Something simple like: fl.nme = 'c:\temp\test.dat' fd = %open(fl.nme,o$rdwr) tbl = 'Single Test Line ':char(10) rc=%write(fd, tbl, len(tbl) ) %close( fd ) Where I have set o$rdwr to different values. Although I don't know where to find the values of this variable for windows environment. I'd like the o$rdwr to really be o$append. |
#7
| |||||||
| |||||||
|
|
Hi Tony The original includes were in an NT file that was removed later. |
|
I agree that having common code is a good idea however one has to tell people about it. |
|
Also calling it unix is the height of stupidity. |
|
If you check the documentation you will find that it constantly refers to unix and one can only guess that it also means NT. In fact you will find several buried references that say does not work on Windows. |
|
As for not working with BASIC, that is at least because the includes have some lower case in them. |
|
Personally when I find one booboo like that I assume that there are probably others. |
|
Overall it is the best idea with the worst documentation in the whole D3 product. Peter McMurray |
That's consistent for most
#8
| |||
| |||
|
#9
| |||||||||
| |||||||||
|
|
big snip Hi Tony I am fascinated by your response. I have the Advanced Pick Reference Manual on my desk - being spiral bound it is handy - no mention of these things that I can find. |
|
Where you got the idea that this all came in with Unix I do not know. |
|
There definitely was a DM,bp,nt file on the first NT releases. |
|
Documentation. Ignoring the mess that was the Update version of the REF file - how many people knew that it contained interesting articles until Grigory freed it up! |
|
I have only ever met one person who lifted a Jaguar bonnet to check a Holden engine, and he also mowed the mat at the office door - well BP green is so confusing when the grass surrounds the office. |
|
If you label something Unix most normal people think that you mean it. |
|
I refer you to the new better and brighter docs - definitely an improvement. |
|
"C functions can be called from a FlashBasic program or subroutine in D3 UNIX implementations using a syntax similar to that of normal C" NOTE - See the Unix man pages for information on any C funtions that are not represented in this guide" "The %creat()fuction creates a new UNIX file or prepares to rewrite an existing UNIX file designated by str for write only" These statements are hardly likely to enthuse an NT user. However if , like me, one is determined, several pages further on one comes to "For Windows: Not Supported" AH Hah! Here we have a way of twisting it, if it does not say no it must mean yes. Yhis guy must have a great way with the ladies in these PC days. Then just as the Unix guys are getting all puffed up the fox jumps into the henhouse. "NOTE - Sockets are a Berkeley Software Distribution (BSD) extension, which may not be available on all Unix platforms" buried on page 498. |
|
You wonder why more people do not know how to use these functions! Peter McMurray |
#10
| |||
| |||
|
|
"Excalibur" wrote: I have the Advanced Pick Reference Manual on my desk - with red spiral binding Those spiral versions were crap. |
![]() |
| Thread Tools | |
| Display Modes | |
| |