943,746 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Marked Solved
  • Views: 2306
  • Assembly RSS
Dec 8th, 2008
0

store input in string

Expand Post »
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?
Similar Threads
Reputation Points: 16
Solved Threads: 0
Junior Poster
sfrider0 is offline Offline
149 posts
since Oct 2008
Dec 9th, 2008
0

Re: store input in string

; 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 ...))
Reputation Points: 40
Solved Threads: 4
Junior Poster in Training
low_coder is offline Offline
55 posts
since Nov 2008
Dec 9th, 2008
0

Re: store input in string

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.
Reputation Points: 16
Solved Threads: 0
Junior Poster
sfrider0 is offline Offline
149 posts
since Oct 2008
Dec 9th, 2008
1

Re: store input in string

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

Assembly Syntax (Toggle Plain Text)
  1. .386
  2. .model flat,stdcall
  3. option casemap:none
  4. include \masm32\include\windows.inc
  5. include \masm32\include\user32.inc
  6. include \masm32\include\kernel32.inc
  7. include \masm32\include\masm32.inc
  8. includelib \masm32\lib\user32.lib
  9. includelib \masm32\lib\kernel32.lib
  10. includelib \masm32\lib\masm32.lib
  11.  
  12. .data?
  13. szBuff db 256 dup(?)
  14. .data
  15.  
  16. .code
  17. start:
  18. call AllocConsole
  19. push sizeof szBuff
  20. push offset szBuff
  21. call StdIn
  22. push offset szBuff
  23. call StdOut
  24. push NULL
  25. call ExitProcess
  26. end start
Reputation Points: 40
Solved Threads: 4
Junior Poster in Training
low_coder is offline Offline
55 posts
since Nov 2008
Dec 9th, 2008
0

Re: store input in string

Got it working! thanks
Reputation Points: 16
Solved Threads: 0
Junior Poster
sfrider0 is offline Offline
149 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: PCSpim/Assembly HELP
Next Thread in Assembly Forum Timeline: EXE file question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC