LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   header file for using getch and also for graphic programming in linux (https://www.linuxquestions.org/questions/linux-software-2/header-file-for-using-getch-and-also-for-graphic-programming-in-linux-652222/)

sandeep_sinu85 06-28-2008 07:15 AM

header file for using getch and also for graphic programming in linux
 
my windows program-

#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#include<math.h>
#include<other.h>
void main()
{
int gd=DETECT,gm,p[100],k,l,n;
float x,y,x2,y2,x3,y3,i;
initgraph(&gd,&gm,"c:\\tc\\bgi");
printf("codes for different motions:\n----------------------------\n");
printf("shm=10,11\tdewll=20,21\ncv=30,31\tcyc=40,41");
printf("\n----------------------------\nEnter the no of paths=");
scanf("%d",&n);
printf("Enter the sequance:\t\t\t\tDisplacment diagram\n");
for(l=0;l<=2*n;l++)
scanf("%d",&p[l]);
printf("----------------------------\nscale:\n x-aixs 1block=10deg");
setcolor(BLUE);
circle(420,200,30);
graph();
for(k=0;k<n;k++)
{
setcolor(WHITE);
line(20,400+2*k,50,400+2*k);
if(p[k]==10||p[k]==11)
shm(p[k],p[k+n],p[k+n+1],x,y,x2,y2,x3,y3,i);
if((p[k]==20||p[k]==21)&&(p[k]!=10||p[k]!=11))
dewl(p[k],p[k+n],p[k+n+1]);
if((p[k]==30||p[k]==31)&&(p[k]!=20||p[k]!=21))
uv(p[k],p[k+n],p[k+n+1],x,y,x2,y2,x3,y3);
if((p[k]==40||p[k]==41)&&(p[k]!=30||p[k]!=31))
cyc(p[k],p[k+n],p[k+n+1],x,y,x2,y2,x3,y3,i);
}
getch();
}


i want to run this program in linux. but main problem is that i work on cluster computer in my college, and can't access /include folder to put my header file 'other.h' as used above in it so what to do to include this file. one more thing, what header file is for getch() and also for in place of 'graphics.h' beside this tell me what correction i should make in my program to run it efficiently...

tronayne 06-28-2008 07:58 AM

A typical way to find out what header file some function is in is to simply look at the man page for the function; e.g., man gethch. It's also typical that you're not going to find Microsoft-specific functions, header files or libraries on non-Microsoft systems so you can, step by step, remove the non-ANSI/ISO headers from the source code and see what the compiler complains about then use man to see if a particular function exists in a Linux system. There may be, although I am not aware of any, open source ports of Microsoft-specific libraries (here Google would be your Good Friend).

The only two header files in your source code that exist in a Linux system are stdio.h and math.h, the others are Microsoft specific.

Your specific problem with other.h is that you put it in the directory where you are building the source (and then #include "other.h" or in an include directory in your home directory or somewhere you can write to; they you would compile with -Ipath_to_include_directory; e.g., if you have an include directory in your home directory you could use -I${HOME}/include. You do not need to use -I if the .h file is in the same directory as your other source.


All times are GMT -5. The time now is 04:24 AM.