hello guys,
I have an assignment to do...that is to create a file, input some string, rename the file and display the contents.
well creating a file, inputing a string into the file and display the contents is working file. But I am not able to rename the file.
I have developed procedures for each of these and posting the code below.
Please see if you can help me with this.
TITLE File Handling
; FILE: file.asm
; This program is to "read a filename from the keyboard. Create the file. Put some strings into the file. and rename it. Display the contents of the file.
;by Kunal Choudhary, 18/03/06
.MODEL SMALL
.STACK 100H
.DATA
CR equ 13
LF equ 10
filedata db 50 dup(?)
filename db 13 dup(?)
fileret db 50 dup(?)
newfilename db 13 dup(?)
cnt db CR, LF, "Do you want to continue?(y/n) :- $"
errinput db CR, LF, "Wrong Input! Try Again.$"
menutitle db "Program to represent File Handling Operations$"
menu1 db CR, LF, LF, LF,"1.Press 'c' to Create File$"
menu2 db CR, LF, "2.Press 'r' to Rename File$"
menu3 db CR, LF, "3.Press 'i' to Input File$"
menu4 db CR, LF, "4.Press 'd' to Display File :-$, CR, LF"
crglf db CR, LF, "$"
menuctfile db CR, LF, "Enter File Name :- $"
inptfile db CR, LF, "Enter text for File :- $"
renfile db CR, LF, "Enter File Name to be Changed to :- $"
filedisplay db CR, LF, "Displaying Content of File :- $"
.CODE
main PROC
.STARTUP
call menu
.EXIT
main ENDP
menu PROC
mov dx, offset menutitle
mov ah, 09h
int 21h
s:
mov dx, offset menu1
mov ah, 09h
int 21h
mov dx, offset menu2
mov ah, 09h
int 21h
mov dx, offset menu3
mov ah, 09h
int 21h
mov dx, offset menu4
mov ah, 09h
int 21h
mov ah, 01h
int 21h
cmp al, 'c'
jne s1
call createfile
jmp xt
s1: cmp al, 'r'
jne s2
call renamefile
jmp xt
s2: cmp al, 'i'
jne s3
call inputfile
jmp xt
s3: cmp al, 'd'
jne s4
call displayfile
jmp xt
s4: mov dx, offset errinput
mov ah, 09h
int 21h
jmp s
xt:
mov dx, offset cnt
mov ah, 09h
int 21h
mov dx, offset fileret
mov ah, 09h
int 21h
ret
displayfile ENDP
END main
hello,
I am currently working on a project, that is take the name of file and returns another file that has all the strings present in the inputfile in ascending order.
example:-
the university
dept of CS
assembler
(ascending order)
assembler
dept of CS
the university
how we will return another file which have data already stored?
which algorithm is best to sort the string in ascending order in assembly language?