vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm using 4gl 7.20.UE1. When popping character values from the stack in a C function I would dearly love to be able to know exactly what the caller put there, particularly how many trailing spaces there really were. (I'd also love to be able to know how big the string was so I wouldn't have to risk truncating it, or to allocate a too-big buffer for it. I suspect that if the former can be done this will be doable as well.) The only way I know of to do something like this is to pass in a second arg which tells how long the first arg was really supposed to be. It isn't much of a solution. 4gl reports can manage this trick, their underlying printlist() function can print out exactly what was put on the stack. Does anybody know how I can manage this in my own programs? I realize that if it's possible at all it'll be using undocumented features, and if that's what it takes I'm resigned to do so. Here's a demonstration of a 4gl report doing what I'd like to be able to do myself. The output of this program: main start report stack_test to screen output to report stack_test() finish report stack_test end main report stack_test() output top margin 0 bottom margin 0 left margin 0 right margin 8191 page length 1 format on every row print from_func_1(), "<" print from_func_2(), "<" print from_func_3(), "<" end report function from_func_1() define s char(20) let s = "unclipped string" return s end function function from_func_2() define s char(20) let s = "clipped string" return s clipped end function function from_func_3() return "constant with 1 trailing space " end function is this: unclipped string < clipped string< constant with 1 trailing space < -- Roderick Schertler <taurine@ibcinc.com> +1-434-963-4034 |
| |||
| varchar should work if your strings don't exceed 255 chars. Roderick Schertler (taurine@argon.org) wrote : > I'm using 4gl 7.20.UE1. > > When popping character values from the stack in a C function I would > dearly love to be able to know exactly what the caller put there, > particularly how many trailing spaces there really were. (I'd also > love to be able to know how big the string was so I wouldn't have to > risk truncating it, or to allocate a too-big buffer for it. I suspect > that if the former can be done this will be doable as well.) > > The only way I know of to do something like this is to pass in a > second arg which tells how long the first arg was really supposed to > be. It isn't much of a solution. > > 4gl reports can manage this trick, their underlying printlist() > function can print out exactly what was put on the stack. Does > anybody know how I can manage this in my own programs? I realize > that if it's possible at all it'll be using undocumented features, > and if that's what it takes I'm resigned to do so. > > Here's a demonstration of a 4gl report doing what I'd like to be able > to do myself. The output of this program: > > main > start report stack_test to screen > output to report stack_test() > finish report stack_test > end main > > report stack_test() > output > top margin 0 > bottom margin 0 > left margin 0 > right margin 8191 > page length 1 > format on every row > print from_func_1(), "<" > print from_func_2(), "<" > print from_func_3(), "<" > end report > > function from_func_1() > define s char(20) > > let s = "unclipped string" > return s > end function > > function from_func_2() > define s char(20) > > let s = "clipped string" > return s clipped > end function > > function from_func_3() > return "constant with 1 trailing space " > end function > > is this: > > unclipped string < > clipped string< > constant with 1 trailing space < > > -- > Roderick Schertler <taurine@ibcinc.com> > +1-434-963-4034 > > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list -- __________________________________________________ ____________________ Joel Schumacher JCPenney Co. - UNIX Network Systems jschumac@jcpenney.com 6501 Legacy Drive M/S 6108 (972) 431-4044 Plano, TX 75024 The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If the reader of this message is not the intended recipient, you are hereby notified that your access is unauthorized, and any review, dissemination, distribution or copying of this message including any attachments is strictly prohibited. If you are not the intended recipient, please contact the sender and delete the material from any computer. |
| ||||
| Joel Schumacher wrote: > > varchar should work if your strings don't exceed 255 chars. Sadly this isn't the case. I'd like to have no arbitrary limits. I'm currently using 8192 bytes for string buffers, and I might have to increase that. Thanks for the response. Roderick |