I wrote some kind of code But i wrote it in Notepad now i want to run this in C Compiler how i can transfer it Into C Compiler.Or any other method is there

Recommended Answers

All 6 Replies

Do you have a particular C compiler in mind?

Download mingw at http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168811236&big_mirror=1
Install it in the directory \mingw. Add \mingw\bin directory to the path, changing start > settings > control panel > system > advanced > environment variables > local variables > PATH. The paths there are separated by semicolon. start > run > cmd, go to your directory where your file is, and run

gcc yourfile.c -o something.exe

When there are errors, you have to fix them. Finally, when it compiles, run something.exe, that's all :)

But notepad is not good for writing code, the worst is that it doesn't show the line number, and doesn't enable you to go to a certain line number, either. But compiler says the line numbers where the errors are, and this is often the only way how you can find these lines. I think the best advice is, download and install gvim http://www.vim.org, and use it instead of notepad. For simple editing, it's not anyhow different than notepad, only if you remember to press i before you start editing. But later, you would find many things which it can do for you, to make both editing and even compiling your code easier. gvim is a programmers editor and so something the programmers use to edit, programmers don't use notepad ;) One thing which you should remember, is that windows explorer doesn't change the directory in the shell. So that when you are in some directory with windows explorer, and then run the cmd console, you are not in that directory there, but in the directory c:\. One way how you can compile and run programs directly from windows explorer, is using gvim. Open your file there with gvim, remember to press escape to go out of editing mode, and you can run any command line after :!, like :!something.exe. Because when gvim edits some file, its working directory is the directory where that file is. Hope that's all so that you can start to compile and run your code.

I would not recommend any IDE, because finally the only thing the IDE does, is that it only makes things more complicated. Who needs these unnecessary rubbish files which IDE always creates, the additional necessity to add all your files in the project, and in addition to all that, making it impossible to use many compiling methods, by writing different makefiles in different places of the source tree etc. IDE is also almost never a standard, different IDE-s have different files and options, the only thing which is really standard is compiling command-line or using makefiles, with a standard cross-platform compiler like gcc. When we write our code, we kind of also have to make it sure that others can compile our code the same way we do, achieving the same results, and it's not good to add to the code a project files of an IDE which the user even may not use. This is finally, the very meaning of the code, this is why it is code, that others can use it the way it is, to achieve the same results. But when one considers an IDE inevitably necessary, then the best choice is likely anjuta, of which there is now a windows version. This is the most widespread IDE in linux, and so kind of most developed, cross-platform, and therefore the best open source one in windows also.

But notepad is not good for writing code, the worst is that it doesn't show the line number, and doesn't enable you to go to a certain line number, either.

Notepad shows the line numbers and allows you go to certain line numbers. View > Status bar

Good, then the notepad has been improved since i last used it, it is that i never use it anyway...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.