I have been asked to fix a program which was written in 1991/1992 on SGI Unix server. I am new to programming. How do I know if the program is written in C or C++ so that I can buy some books and start?
Thanks in advance.
I have been asked to fix a program which was written in 1991/1992 on SGI Unix server. I am new to programming. How do I know if the program is written in C or C++ so that I can buy some books and start?
Thanks in advance.
If it compiles with a C compiler then it's C. :-) But seriously, sort of, you can use something like this
Code:#if defined(__cplusplus) /* It's in C++ */ #elif /* It's in C */ #endif
*Cela*
I have been asked to use 'make' to compile the program file. the filename is a300tom.c and I use 'make a300tom' to compile this file. This shows 'cc -o a300tom....' when I run make command. Does that make sure this is a C program?
And, I have heard about book from Ritchie and Kernigham for C. is that the best book for my case? I have a developed/prev functional program which is not running now, probably because the device it was attached /writing/reading to ( touch screen) is new one & the program is probably not recognizing it.
Thanks a lot.
mayb an easier way
Code:cout //used in C++//Code:printf /*used in C*/
Originally Posted by Salem
>I have been asked to use 'make' to compile the program file. the
>filename is a300tom.c and I use 'make a300tom' to compile this
>file. This shows 'cc -o a300tom....' when I run make command.
>Does that make sure this is a C program?
Since the extension is .c, I think it is a C-file. Added to the previous tests, you could also create a test-file like this:
If it compiles, then it is C++.Code:#include <iostream> int main () { std::cout << "Test" << std::endl; return 0; }
>And, I have heard about book from Ritchie and Kernigham for C.
>is that the best book for my case?
If you program is a C++ program, then it is not the best book, since the book of Kernighan and Ritchie describes C and not C++.
[edit]
>C++: OOP
A C++ program is not necessarily OOP and a C program can be object oriented.
[/edit]
Yeah, but it's often better to use OOP programming in C++ for bigger solutions, like Servers.....
Perhaps, but that is not the question here.