China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-31 19:49
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » 请问在DOS或CMD命令行中如何实现C语言编辑的? Translated as: How to implement C language editing in DOS or CMD command line? View 3,487 Replies 2
Original Poster Posted 2018-04-06 03:47 ·  中国 广西 防城港 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Writing and running a C program under DOS :sanqima
https://blog.csdn.net/sanqima/article/details/7473078

1) "Start" -- "Run" -- cmd -- Enter, enter the DOS interface,

C:\Documents and Settings\Administrator>cd C:\Documents and Settings\Administrat
or\Desktop
2) First create a C program, named cyuyan.c, as follows:

C:\Documents and Settings\Administrator\Desktop>copy con cyuyan.c
#include<stdio.c>
void main()
{
printf("Hello World!");
}
^Z
1 file(s) copied.

C:\Documents and Settings\Administrator\Desktop>type cyuyan.c
#include<stdio.c>
void main()
{
printf("Hello World!");
}

Note: ^Z means using the Ctrl+Z shortcut key to terminate the writing of the file.

3) Compile the cyuyan.c file, use the cl cyuyan.c command, as follows:

C:\Documents and Settings\Administrator\Desktop>cl cyuyan.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

cyuyan.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:cyuyan.exe
cyuyan.obj

4) Finally, execute the cyuyan.c program, enter cyuyan.exe, as follows:

C:\Documents and Settings\Administrator\Desktop>cyuyan.exe
Hello World!
C:\Documents and Settings\Administrator\Desktop>
------------------------------------------------------------------------------------------
According to the instructions, it seems that it didn't execute successfully. Do you need to install something?


Compiling programs using the CL command in DOS
https://blog.csdn.net/guchaono1/article/details/71438999
_花谢花飞飞_ cl.exe  (cl.zip should be 32-bit)
http://vdisk.weibo.com/u/2063062242

Microsoft CL.exe Compiler      :Bingsen (The explanation of cl.exe is relatively good)
https://lellansin.wordpress.com/2013/06/11/%E5%BE%AE%E8%BD%AF-cl-exe-%E7%BC%96%E8%AF%91%E5%99%A8/


C Language Compiler CL.exe :veis (cl.7z=64-bit)
https://www.cnblogs.com/veis/p/6940930.html

[ Last edited by zzz19760225 on 2018-4-9 at 12:06 ]
Attachments
dm111.png
dm222.png
CL.zip (160.27 KiB, Downloads: 1)
dm333.png
CL.7z (3.8 MiB, Downloads: 1)
mlhc.png
1<词>,2,3/段\,4{节},5(章)。
Floor 2 Posted 2018-04-06 17:34 ·  中国 黑龙江 移动
中级用户
★★
Credits 365
Posts 212
Joined 2018-01-27 00:00
8-year member
UID 182622
Status Offline
Because the CL.EXE linker is not placed in the C:\ location under your WINDOWS. The CL.EXE linker is not placed in the A:\ location of DOS.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
zzz19760225 +2 2018-04-06 19:43
很少上线的游客前来。
Floor 3 Posted 2018-04-09 12:00 ·  中国 广西 防城港 电信
超级版主
★★★★
Credits 3,673
Posts 2,020
Joined 2016-02-01 00:00
10-year member
UID 181465
Gender Male
Status Offline
Originally posted by LoggerVick at 2018-4-6 17:34:
The CL.EXE linker is not placed in the C:\ location under your WINDOWS
The CL.EXE linker is not placed in the A:\ location under DOS

----------------------------------------------------------------
The cl.7z one worked, although pressing Enter automatically adds an extra line, but it can run.

Just modify the file content manually! :(

Why did it work the first time and then all errors later?

 Mistake in entering i and l. (But the two in the first picture are l instead of i!? It's a text display issue, actually it's i.)

[ Last edited by zzz19760225 on 2018-4-9 at 14:14 ]
Attachments
mlhc1.png
mlhc2.png
mlhc3.png
mlhc4.png
1<词>,2,3/段\,4{节},5(章)。
Forum Jump: