store input in string

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Oct 2008
Posts: 89
Reputation: sfrider0 is an unknown quantity at this point 
Solved Threads: 0
sfrider0 sfrider0 is offline Offline
Junior Poster in Training

store input in string

 
0
  #1
Dec 8th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 23
Reputation: low_coder is an unknown quantity at this point 
Solved Threads: 2
low_coder low_coder is offline Offline
Newbie Poster

Re: store input in string

 
0
  #2
Dec 9th, 2008
; 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 ...))
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 89
Reputation: sfrider0 is an unknown quantity at this point 
Solved Threads: 0
sfrider0 sfrider0 is offline Offline
Junior Poster in Training

Re: store input in string

 
0
  #3
Dec 9th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 23
Reputation: low_coder is an unknown quantity at this point 
Solved Threads: 2
low_coder low_coder is offline Offline
Newbie Poster

Re: store input in string

 
1
  #4
Dec 9th, 2008
; 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

  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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 89
Reputation: sfrider0 is an unknown quantity at this point 
Solved Threads: 0
sfrider0 sfrider0 is offline Offline
Junior Poster in Training

Re: store input in string

 
0
  #5
Dec 9th, 2008
Got it working! thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC