![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-14 23:23 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS开发编程 & 发展交流 (开发室) » Programming for calculating available memory under DOS |
| Printable Version 3,358 / 4 |
| Floor1 JasonDay | Posted 2008-08-08 16:24 |
| 初级用户 Posts 10 Credits 26 From shenzhen | |
|
MS C Programming Environment
After reading several articles, I tried using memmax memval, but none worked. Can't get the correct result as from mem or Cs.com. I remember using DOS calls to do it originally. Asking if anyone has done it, show off. |
|
| Floor2 JasonDay | Posted 2010-12-17 16:35 |
| 初级用户 Posts 10 Credits 26 From shenzhen | |
|
Once again, I would like to ask. Under the MS C programming environment, how to obtain the data of available conventional memory similar to that in C:\DOS> MEM /c?
|
|
| Floor3 JasonDay | Posted 2010-12-18 17:01 |
| 初级用户 Posts 10 Credits 26 From shenzhen | |
|
To redirect the output of `mem /c` to `mem1.txt` using `spawnl`, you need to use a shell to handle the redirection. You can use `cmd.exe` with the `/c` option to execute the command and redirect the output. Here's how you can modify the code:
```c spawnl(_P_WAIT, "cmd.exe", "cmd.exe", "/c", "c:\\dos\\MEM.exe mem /c > mem1.txt", NULL); ``` This will use the Windows command prompt (`cmd.exe`) to execute the `MEM.exe` command with the `/c` option and redirect the output to `mem1.txt`. |
|
| Floor4 zhgwbzhd | Posted 2011-01-05 10:11 |
| 高级用户 Posts 187 Credits 506 | |
|
You can check the materials. There is a fixed memory address that marks the available memory. You can directly read the value there to get the available memory.
|
|
| Floor5 enjoyer | Posted 2011-01-11 09:11 |
| 中级用户 Posts 140 Credits 351 | |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |