Search found 866 matches

by Joris
Sun Apr 28, 2013 3:38 pm
Forum: Coding Questions
Topic: CreateRegularExpression doesn't work like should ...
Replies: 6
Views: 776

Re: CreateRegularExpression doesn't work like should ...

Sorry, but just the weird collection of Regular Expression that you post here shows, that you don't know what you are doing. Regarding Regular Expressions, trial and error will not get you very far. There is much free stuff on the internet for learning Regular Expressions. Because mine didn't work,...
by Joris
Sun Apr 28, 2013 11:59 am
Forum: Coding Questions
Topic: CreateRegularExpression doesn't work like should ...
Replies: 6
Views: 776

CreateRegularExpression doesn't work like should ...

I don't like to anounce this but ... In this topic http://www.purebasic.fr/english/viewtopic.php?f=13&t=54498 I tried a setup with different regular expressions-patterns and flags, but not one gives the same result as should, with the 'Procedure Split_String(regel$, split$)' shown below in that ...
by Joris
Sun Apr 28, 2013 8:54 am
Forum: Coding Questions
Topic: Split file in stringarray using blank lines as delimiter ?
Replies: 23
Views: 2448

Re: Split file in stringarray using blank lines as delimiter

Still not an answer to my question but the best solution if CreateRegularExpression(0,"\xD\xA\xD\xA") doesn't work (and so imo has a bug). Procedure.s File_Into_Mem(file$) OnErrorCall(@ErrorHandler()) If MyFileBuffer FreeMemory(MyFileBuffer) EndIf open.l=ReadFile(#PB_Any,file$) If open MyF...
by Joris
Sun Apr 28, 2013 7:43 am
Forum: Coding Questions
Topic: Split file in stringarray using blank lines as delimiter ?
Replies: 23
Views: 2448

Re: Split file in stringarray using blank lines as delimiter

The solution doesn't matter if a single command or a procedure as long as it is fast and does the job. :wink: Depending on the size and number of your files to process, regular expressions can be really slow. And why use them when you can code the answer in a few speedy lines? A PB command should w...
by Joris
Sat Apr 27, 2013 10:42 pm
Forum: Coding Questions
Topic: Split file in stringarray using blank lines as delimiter ?
Replies: 23
Views: 2448

Re: Split file in stringarray using blank lines as delimiter

@RASHAD thank you, only your code comes a bit closer to what I wont. Yet, to split on empty lines there should be some kind of double CRLF pattern... @skywalk to me a command is a single instruction like 'ExtractRegularExpression' and not a complete procedure (which in your links I had seen before)....
by Joris
Sat Apr 27, 2013 6:19 pm
Forum: Coding Questions
Topic: Split file in stringarray using blank lines as delimiter ?
Replies: 23
Views: 2448

Re: Split file in stringarray using blank lines as delimiter

@skywalk : In PB5.11 there is no multiline Split() command except in a regular expression :
\n Matches a linefeed character.
\r Matches a carriage return character.
@jassing : I wont to split at blank lines because I need that.
by Joris
Sat Apr 27, 2013 2:22 pm
Forum: Coding Questions
Topic: Split file in stringarray using blank lines as delimiter ?
Replies: 23
Views: 2448

Split file in stringarray using blank lines as delimiter ?

Yeah me again guys... sorry but I'm quit bussy (and learning) converting lots of stuff into PB code. I try to split a text file into parts using blank lines as delimiter, but it doesn't work. I used Perl-compatible regular expressions elsewhere with success, but not in PB (see http://www.pcre.org/pc...
by Joris
Sat Apr 27, 2013 11:26 am
Forum: Coding Questions
Topic: ReadFile trouble...
Replies: 3
Views: 347

Re: ReadFile trouble...

Strange one, not least because UE is very good at file sharing. Seems possible the file is corrupted in some way (is drive e: a USB key or something like that?), and so the end of the file is may be never found - thus the file is never closed. When your app exits, you could for example test to see ...
by Joris
Sat Apr 27, 2013 10:05 am
Forum: Coding Questions
Topic: ReadFile trouble...
Replies: 3
Views: 347

ReadFile trouble...

Hi, I ran this code but suddenly it didn't wont to open the requested file anymore. The file wasn't in use by any other program. Debugging to find the error results like => : [11:01:49] [WARNING] The OnError library may not catch all errors with enabled debugger. So I tried to open it in my editor (...
by Joris
Thu Apr 25, 2013 8:35 am
Forum: Coding Questions
Topic: What is wrong with StructureUnion ?
Replies: 6
Views: 442

Re: What is wrong with StructureUnion ?

no, if you use static array use [] Structure BTS_32 StructureUnion bnd.b[16] bts.l[4] EndStructureUnion EndStructure Why does the bts.l[] static array have 4 elements while it is starting from 0 (0-1-2-3-4 should be 5 elements) ? I looked in the help file already but don't find anything about this....
by Joris
Wed Apr 24, 2013 8:41 pm
Forum: Coding Questions
Topic: What is wrong with StructureUnion ?
Replies: 6
Views: 442

Re: What is wrong with StructureUnion ?

STARGÅTE wrote:no, if you use static array use []
Oh, ok, I already had mistaken the other type {} for fixed strings....
Thanks.
by Joris
Wed Apr 24, 2013 8:29 pm
Forum: Coding Questions
Topic: What is wrong with StructureUnion ?
Replies: 6
Views: 442

Re: What is wrong with StructureUnion ?

Ooops I got it : Array must be in front bnd.b(15).
by Joris
Wed Apr 24, 2013 8:26 pm
Forum: Coding Questions
Topic: What is wrong with StructureUnion ?
Replies: 6
Views: 442

What is wrong with StructureUnion ?

I try this simple StructureUnion but PB doesn't accept it : 'Garbage at the end of the line' ???

Code: Select all

 Structure BTS_32 
    StructureUnion 
       bnd.b(15)
       bts.l(3)
    EndStructureUnion
 EndStructure
Thanks
by Joris
Wed Apr 24, 2013 4:48 pm
Forum: Coding Questions
Topic: ForEach GadgetType() or...
Replies: 6
Views: 722

Re: ForEach GadgetType() or...

A way to programmatically iterate through all PB gadgets would be nice, considering PB already has a ForEach for other uses. Maybe you could make a feature request for it :) I have already a more important request : a real replacement for BitBlt (see the 128 fader topic). But anyone may add the abo...