The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Farabi on May 18, 2010, 01:09:14 AM

Title: nrQsortA
Post by: Farabi on May 18, 2010, 01:09:14 AM
Can I sort a list of text terminated by CRLF?
Or I need to create the text table?
Title: Re: nrQsortA
Post by: dedndave on May 18, 2010, 02:54:18 AM
C:\>type unsort.txt|sort.exe>sort.txt :bg
Title: Re: nrQsortA
Post by: Farabi on May 18, 2010, 03:26:17 AM
Quote from: dedndave on May 18, 2010, 02:54:18 AM
C:\>type unsort.txt|sort.exe>sort.txt :bg

:lol
I want to include it on my program, not using a third party one.
Title: Re: nrQsortA
Post by: hutch-- on May 18, 2010, 06:09:42 PM
Onan,

Yes you can sort text which has CRLF pairs at the end of each sentence. Most string sorts sort arrays of strings so they do compares until either a miswmatch or a zero.
Title: Re: nrQsortA
Post by: Farabi on May 19, 2010, 12:41:06 AM
Quote from: hutch-- on May 18, 2010, 06:09:42 PM
Onan,

Yes you can sort text which has CRLF pairs at the end of each sentence. Most string sorts sort arrays of strings so they do compares until either a miswmatch or a zero.

So you mean I need to list all of the words using CFLF first before Im using nrQsortA?
Title: Re: nrQsortA
Post by: hutch-- on May 19, 2010, 03:44:37 AM
Onan,

Have a look at these two procediures in the MASM32 library.


assort proc arr:DWORD,cnt:DWORD,rdi:DWORD ; ascending version
dssort proc arr:DWORD,cnt:DWORD,rdi:DWORD ; descending version


They are documented in the masm32 library help file and are reasonably straight forward to use. IMPORTANT, read the reference material in the help file and do not construct an array of strings that have NULL pointers in any of the array members, otherwise filter the NULL pointers out BEFORE you sort the array.