Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

Hello guys, here is the thing, a professor sent me a .c file to edit it, I know that this was done un C or C++ Software, I cannot find the way to get this opened, I downloaded codeblocks and no worked at all (or I am missing something).. could you please help me with it?

5 stars for accurate answers will be given.

Please let me know if you need the .C file.
Posted
Updated 10-Oct-15 8:32am
v3
Comments
PIEBALDconsult 10-Oct-15 14:32pm    
Any text editor will work. Try Notepad.
Member 11267069 10-Oct-15 14:36pm    
Ok, this is for edit it, perfect, now, I want to compile it, I mean, create the .exe file, I tryed with Dev C++ and there are "errors" in the code, no way, I think that since is a very new version it not supports anymore this file, any suggestion??
PIEBALDconsult 10-Oct-15 14:48pm    
If there are errors, they are unlikely to go away simply by using a different compiler (but maybe).
Anyway, please use Improve question to add the text of the error and the text of the line(s) that cause the error.
Also include the command-line you used to execute the compiler.
Afzaal Ahmad Zeeshan 10-Oct-15 14:51pm    
That is suffice, but I would recommend that he contacts his teacher to get help (because these assignments and institute-based stuff needs a lot of hard work and effort), who sent the file. If his teacher had the same errors, then I wonder what might help him. :laugh:
Member 11267069 10-Oct-15 14:58pm    
That is true, this teacher is intended to make us fail, He got the code from this webpage: http://www.dailyfreecode.com/DisplayArticle.aspx?MySyntaxId=1018

according to him, we need to translate the software and then just run it.

Please people, I am in a real hurry, try to help me with this.

1 solution

Having a C program source code is not enough, you need to have a compiler too. Then, compiler would need the references (locations) where to find the headers (if there are any in the source code). Those headers need to be accessible by the compiler, to link them and create an executable.

So, just the Code::Blocks or Dev C++ is not enough. You have to understand how a program is actually created.

1. You write the program in C programming language.
- As mentioned in comment to your question, by PIEBALDconsult, you can write the program in anything... Anything. There is no need to have Visual Studio installed!
2. Make sure you are having a compiler for that language. If you are not going to install an IDE, GCC is your bet! GCC compiler for C[^] would compile the source code and give you an executable. For that C source file.
3. Compiler, if finds any errors, will notify you! So, ensure to fix them. (Coming to this point later)
4. Execute the executable file created to see the output.
- It depends on frameworks, on Windows you can double click and a console will open, on Linux-based systems, to see the output you may want to open a terminal at that location first.

Now, that is the entire process. If you understood it, great, if you didn't. Start by following (and performing the steps) from the step 1.

The thing you mentioned, "errors" in it. The errors are because the compiler doesn't understand what you wrote. Compiler is smart enough, but not smart enough to solve the problems for you. :-)

So you have to solve the problems yourself. In case of C, that can be a headache. If you cannot solve them, I recommend you contact your teacher and ask him to help you out. :-)
 
Share this answer
 
Comments
PIEBALDconsult 10-Oct-15 14:54pm    
There could also be implementation-specific syntax, macroes, or whatever involved.
Or the solution to the errors could be as simple as specifying the locations of headers and libraries on the command-line.
Afzaal Ahmad Zeeshan 10-Oct-15 14:58pm    
And that conversation and take all night long (or day, if you're enjoying the Sun) because C can be an angry wife, expecting you to fix everything, even if you didn't make it go wrong. :-)

But, I would still recommend he contacts his instructor. His instructor needs to know where he lacks knowledge of C programs and environments.
PIEBALDconsult 10-Oct-15 15:01pm    
It's midday here, and I agree.
Afzaal Ahmad Zeeshan 10-Oct-15 15:02pm    
Ah, good afternoon! :-)
Member 11267069 10-Oct-15 15:19pm    
Afzaal Ahmad Zeeshan

The think is that I do have the source code, but I can not compile it, as simple and stupid as it sounds, I can not, thisis the sourcecode:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900