LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-28-2008, 07:15 AM   #1
sandeep_sinu85
LQ Newbie
 
Registered: Jun 2008
Posts: 1

Rep: Reputation: 0
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...
 
Old 06-28-2008, 07:58 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Geting error loop QFike:getch: File not open QFile:atEnd: this file is not open badgerbox76 Linux - Newbie 6 01-07-2006 05:30 PM
programming the mouse in a VESA graphic mode in Linux Zither Programming 5 03-18-2004 05:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration