How do I save a string? Say I type in "sfrider0." How do I store that then retrieve it later? I've been messing around with it for a while and the most I can get it to do is tell me how many characters are in it. Any help?

9 Years
Discussion Span
Last Post by sfrider0

; you mean storing it even after program close?
; then : In Registry (RegOpenKeyEx, RegQueryValueEx, RegSetValueEx ...) , In a File ( CreateFile, WriteFile, ReadFile ...), In .ini File ( you can easily do that by special API funcs (e.g: GetPrivateProfileString, WritePrivateProfileString ...))


No, just store during the program. I'm trying to input two strings, then put them in alphabetical order. I understand how to compare and order two strings that are hard coded.


; you have to allocate enough memory for the string in the ".data?" ; section:
szBuff db 256 dup(?)
; then when you call StdIn it will write user input into szBuff

	.model flat,stdcall
	option casemap:none
	include \masm32\include\windows.inc
	include \masm32\include\user32.inc
	include \masm32\include\kernel32.inc
	include \masm32\include\masm32.inc
	includelib \masm32\lib\user32.lib
	includelib \masm32\lib\kernel32.lib
	includelib \masm32\lib\masm32.lib

	szBuff				db  256 dup(?)
call AllocConsole
push sizeof szBuff
push offset szBuff
call StdIn
push offset szBuff
call StdOut
push NULL
call ExitProcess
end start
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.