Just starting out easy points

Posted on 2004-04-14
Last Modified: 2010-04-15
I am just starting to learn to program just a little bit um i am trying to find out how to open files from the c promt but i can't and what is the best way to learn to program?
Question by:WhlGyro
  • 2
  • 2
  • 2
  • +4

Accepted Solution

Cayce earned 42 total points
ID: 10828629
LVL 11

Assisted Solution

avizit earned 42 total points
ID: 10829290
To open a file you have to use a editor

from a dos prompt  you can type "EDIT <filename>"

but believe me editing files in DOS is not a pleasant experience , you would be better off using one of those windows IDE for developing programs

for C programming you can use
Microsoft Visual C++
or free ones like devcpp


LVL 12

Assisted Solution

stefan73 earned 41 total points
ID: 10830951
Hi WhlGyro,
If you want to do it the "real way" without the "point-and-click" fuss, download cygwin ( and gvim ( and use gvim and gcc.

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


Expert Comment

ID: 10833940
If you want to learn C programming,
Read Kernighan & Ritchie(k&r as it is called) The C programming Language

For opening files,i think the previous comments have covered a lot of options.

Expert Comment

ID: 10833964
>how to open files from the c promt

Do u want to know how to do this using C??

If that is the case,use fopen().

Pls post back for any clarifications.

Expert Comment

ID: 10835499

Like Stefan said I would grab cygwin if I was stuck with Windows so that I could use the gcc compiler. Then I would get a text editor. ViM is good, but I personally like GNU Emacs better. There is a binary version for Windows you can download and you can do just about everything within the editor.

Regards, m.

Expert Comment

ID: 10836387
>> how to open files from the c promt
for files which have text based information or text files, u have to use the MS-DOS text editor (to view file contents and editing). Likewise there are different classes of programs which open different classes of files. But all files can't be opened from DOS prompt which u are referring as the C prompt. Image or picture files can be opened by programs like Mspaint, Adobe Photoshop etc. Audio files like *.wav, *.mid, *.mp3 are opened by Windows Media Player, etc ...
Each special type of file has a header which has all the information about the file which is required by its appr program to open. u can even write a prog. to open an image file like *.bmp or *.jpeg , etc in C by incorporating its header structure. Anyway thats meaningless to do from DOS.
From C program u have to learn about the command line parameters and file operations to get an idea of how to write programs in C to open files . here is a small piece of code for u to understand the process of file openning.
// name the file as prog.c

int main(int argc,char *argv[])
 int c;
 FILE * fp; // this is the pointer to file structure
 /* argc is the number of arguments and argv is an array of          strings argv[0] being the prog name, argv[1] the first parameter and so on... */
 if((fp=fopen(argv[1],"r"))==NULL){ // file opened in read mode
    printf("cannot open file");return 1;}
    while((c=fgetc(fp))!=EOF){putc(c);} // put to terminal until EOF
    fclose(fp); // flush and unlink all buffers for fp
    return 0;
compile and build this code
suppose u have a text file t.txt
c:\tcc>prog t.txt
will display ur file contents.

LVL 12

Expert Comment

ID: 10840471
> ViM is good, but I personally like GNU Emacs better
Aaah... An Emacs zealot.

Of course, Emacs is nice. It has to be, since it's a Unix tool. But apart from that...

Real men use vi in ex mode only :-)


Expert Comment

ID: 10842644

Found a good introduction on both Vi and emacs.. very short but in one page gives you an idea of the differences. <@;)


Expert Comment

ID: 11025499
hi everybody!
yeah,command line parameters rule!opening a text file using command line parameters is pretty easy to learn.once u get the hang of it, u can do just about anything.
bye 4 now

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question