LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-11-2010, 08:13 AM   #16
grisu42
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Rep: Reputation: 1

Or you can use the system-call

Code:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char * argv[]) {
  printf("SPAM! Line.\n");
  fflush(stdout);
  
  /* The system("clear")-call is interesting for you! */
  system("clear");			// Calls "clear" in the console - for the system-call you need the stdlib.h
  
  printf("New line\n");
  fflush(stdout);
  
  return EXIT_SUCCESS;			// Linux-specific exit-code is in the stdlib.h
}
EDIT
In fact it doesn't clear the screen, it simply moves the "old" text to the top, so that the console seems to be cleared ...
With the following command you can move the cursur to the right upper corner of the screen. Then simply write lots of spaces and you have a really blanked screen.
Code:
printf("\033[1;1H");

Last edited by grisu42; 03-11-2010 at 08:16 AM. Reason: addition
 
Old 03-11-2010, 11:25 AM   #17
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by zeezulander View Post
hi again..

i know where i put the conio library but someone else in the forum stated that there is a standard location in which library files are usually stored.. i want to know what that library file is..

i know the following might sound a little naive.. but the thing is, the tarball i downloaded contained SO many files and conio.h was one file among them.. what exactly do i consider to be the library file? is there some process where i'm expected to concatenate all these files into forming one "library" file? or can the conio.h file be directly used?

I would also like some direction as to where i could find a comprehensive tutorial of the very basics of linux as i feel that all these problems are a result me not understanding how linux works..

If i'm not crossing the line here.. how did YOU guys get acquainted with Linux?
Hi again,

as I already said, libraries are usually located in the /lib directory in Linux. Libraries usually contain a *.so.* extension. Look in your files that match that pattern and try copying them into the /lib directory. You might have to run ldconfig afterwards, I am not 100% sure about that.

P.S.: The pattern for the libraries I posted above is valid for shared libraries. There are also static libraries which end on *.a
 
Old 03-11-2010, 12:15 PM   #18
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi zeezulander,

Let's start with where you got that Linux conio-thing from,
what it looks like (inside, that is) and what you did with it
after unpacking.

I found one, the content of which is like:
Code:
ls libconio-1.0.0/
AUTHORS      NEWS        clrscr.3      conio.h        textbackground.3
COPYING      README      config.guess  gotoxy.3       textcolor.3
ChangeLog    aclocal.m4  config.sub    install-sh     wherex.3
INSTALL      cgetch.3    configure     ltmain.sh      wherey.3
Makefile.am  cgetche.3   configure.in  missing
Makefile.in  clreol.3    conio.c       mkinstalldirs
To make that one available to your system you'd go
Code:
cd libconio-1.0.0 && ./configure && make && make install
To then compile your code:
Code:
gcc -L/usr/lib -lconio -o helloWorld helloWorld.c
Quote:
If i'm not crossing the line here.. how did YOU guys get acquainted with Linux?
Very much like riding a bike; just hop on and try.


And with these words, I'd like to refer back to post #14 by paulsm4 ...
you'd really be better off trying to use something more Linuxy as learning
material if this is what you're after.



Cheers,
Tink
 
1 members found this post helpful.
Old 03-13-2010, 11:59 PM   #19
zeezulander
LQ Newbie
 
Registered: Nov 2008
Posts: 17

Original Poster
Rep: Reputation: 0
Adding a bit of context

Quote:
Originally Posted by paulsm4 View Post
Hi, again zeezulander -

I really hate to see you spin your wheels, and I'm very much afraid that might be what's happening.

Q: what is it you're trying to do?

Q: If you're just experimenting with some sample code that happened to use "conio.h", could you please tell us a little bit more about it. For example, where did you get it? Or what is it about the code that interested you?

'Cos here's the deal: "conio.h" is a relic of DOS; a throwback to the late 1980's. If, for whatever reason, the program that uses it is useful to you - cool. We can give you a workaround. But if it's just some "sample code" you wanted to experiment with - heck, we can probably point you in a MUCH better direction.

Either way, please give us a bit more context about what you actually need - and we'd be happy to help.

Anytime!

Sincerely .. PSM
hi paulsm4,

Well i guess you're absolutely right, i AM simply trying on a bit of code to just figure out how things work in Linux, I'm really new to the whole concept of manually linking and "make"ing files. It's not that is was trying sample code, I was just going step by step, increasing the level of complexity of the code to see what kinda errors i would encounter..

I first started with a simple "printf" program, then tried importing other standard libraries such as "string.h" and "ctype.h" to see if the same functions were available. THEN i imported the conio.h library simply to CLEAR THE SCREEN / TERMINAL using clrscr() this is where i got stuck.. in the beginning i had no idea that conio.h wasn't a linux library, then i read around using google and found a library for linux that mimics the conio.h library, and was unable to link it to the program that i was writing.

Well i've seen in this thread that the conio.h is relic and that i shouldn't really use it... well i agree with that but i guess what my problem ACTUALLY is...

How do i link a non-standard library / header file to a C program that i'm writing? i wouldn't have to be conio.h, what if wrote my own header file? what do i need to do to attach to ANOTHER program in order to use any functions that i've written in it?
 
Old 03-14-2010, 12:09 AM   #20
zeezulander
LQ Newbie
 
Registered: Nov 2008
Posts: 17

Original Poster
Rep: Reputation: 0
would like a BIT more info

Quote:
Originally Posted by Tinkster View Post
Hi zeezulander,

Let's start with where you got that Linux conio-thing from,
what it looks like (inside, that is) and what you did with it
after unpacking.

I found one, the content of which is like:
Code:
ls libconio-1.0.0/
AUTHORS      NEWS        clrscr.3      conio.h        textbackground.3
COPYING      README      config.guess  gotoxy.3       textcolor.3
ChangeLog    aclocal.m4  config.sub    install-sh     wherex.3
INSTALL      cgetch.3    configure     ltmain.sh      wherey.3
Makefile.am  cgetche.3   configure.in  missing
Makefile.in  clreol.3    conio.c       mkinstalldirs
To make that one available to your system you'd go
Code:
cd libconio-1.0.0 && ./configure && make && make install
To then compile your code:
Code:
gcc -L/usr/lib -lconio -o helloWorld helloWorld.c

Very much like riding a bike; just hop on and try.


And with these words, I'd like to refer back to post #14 by paulsm4 ...
you'd really be better off trying to use something more Linuxy as learning
material if this is what you're after.



Cheers,
Tink
hi Tinkster!!

Yeah this is exactly what I got!! while thanking you for the help, i would REALLY appreciate it if you could give me a VERY brief explanation as to why all these files are needed... why can't a single header file be pasted in the same folder as the ".c" file and included and used in the program like in windows? what is it that happens differently in Linux? i know you're against spoon feeding through your end line after each post i'm not into it myself hehe.. but it helps sometimes to get insight from a source that has SOME idea of the level and context of the reader
 
Old 03-14-2010, 03:46 AM   #21
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by zeezulander View Post
hi Tinkster!!

Yeah this is exactly what I got!! while thanking you for the help, i would REALLY appreciate it if you could give me a VERY brief explanation as to why all these files are needed... why can't a single header file be pasted in the same folder as the ".c" file and included and used in the program like in windows?
It's been a LONG time that I've last used a windows
compiler; but I assure you that a simple 'header' file
compiled against a .c file won't render anything useful
unless you a) have the full source that belongs with the
header in the same dir, or b) have a library (DLL) to go
with it.

Quote:
Originally Posted by zeezulander View Post
what is it that happens differently in Linux? i know you're against spoon feeding through your end line after each post i'm not into it myself hehe.. but it helps sometimes to get insight from a source that has SOME idea of the level and context of the reader
You don't need ALL those files. It's just that these things
are written to be portable; and a library compiled for a
machine using e.g. libc-2.1 on an ARM based computer won't
be doing you any good if your machine is x86 and using
libc-2.3, for example. To BUILD the library that you can
use with your header for a local project on your machine
everything required to build it is provided. Hence the
'abundance of files'. In the install you'll most likely
only end up with the header, the lib and maybe the man-
pages; perfectly sane.



Cheers,
Tink
 
  


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
Linux Header files not found Frank85 Linux - Kernel 16 11-27-2009 01:42 AM
Linux Header Files Roy-Svork Programming 8 08-01-2005 08:45 AM
Linux kernel header files cranium2004 Programming 4 03-04-2005 04:41 AM
c header files in linux in place of header files in windows? harun_acs Programming 1 03-17-2004 02:24 AM
qt-3.1.2 header and libraries...where are they? Hammett Linux - Software 1 11-10-2003 08:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:26 PM.

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