News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

sorting string dates

Started by icelated, August 05, 2012, 04:14:40 PM

Previous topic - Next topic

icelated

I am currently reading in a file of 3 books which include (author, title, and date) and printing it.
What i want to do is sort it by date. Im not picky on what to use.

I think i need to check for carriage returns
I think i  need to convert to number's and store them in separate registers. Even, if thats true not sure where to begin!

Im just not sure what to do. I  need some type of algorithm needed to accomplish this.
Or some help

I know i will need some type of case for the month

here is the part that reads in the file and prints it.




read_file MACRO

   
    mov hFile, fopen("input.txt")


     print chr$(" ",13,10)
     fclose hFile

ENDM




here is the file


3

Owl Knight
NOV-30-2000


jj2007

Convert the entries to format
20091223<tab>Name<tab>etc
and use a simple string sort.

Wrong sub-forum, by the way - your code is 32 bit. Moderator will move it to the campus, I suppose.

icelated

What can i use for the string sort? Is there some type of comparison? like a bubble sort?

I cant access the other forum(masm32). I register and they say they send me an email but i never get it. I tried different emails.
So i can use the 3 in the file to know where to look for the date? grab bits and store it in different registers?

fearless

If you know the format of the date strong and verify it is correct, you could convert the string date to julian date format - which gives an integer as the date value, which can then be used to compare dates for sorting

jj2007


dedndave

i think there is a function written for you in the masm library
look at the help files in the masm32\help folder