just wanted to add that system("CLS") or system("PAUSE") ... is a little bit slower to respond than and not as smmoth as clrscr() or getche()
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-01-19
.c files should be separately compiled and linked - not included. Only .h files should be included, and these should not contain any data instantiation or function definitions - only (extern) declarations.
This is more efficient from a compiler point of view, (it only compiles the modules that have changed), and if you have more than one module that includes the same .c files containing function code and/or data instantiation, then linker errors will occur.
You may be only writing single module apps at present, so do not see the problem - but such bad practices will bite you in the end.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FYI: I have found CLEAR as the Unix equivalent to Windows' CLS. But there doesn't seem to be an equivalent to PAUSE as a standard shell command in Unix...
qWake
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FYI: I have found CLEAR as the Unix equivalent to Windows' CLS. But there doesn't seem to be an equivalent to PAUSE as a standard shell command in Unix...
qWake
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
People who want to use clrscr and can't seem to get it work with DevC++ for whatever reason can do this
1. Create a clrscr.c file
and add the following code......
#ifndef _CONIO_C_
#define _CONIO_C_
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <windows.h>
#include <string.h>
#include "conio.h"
#ifndef _COLORS_
#define _COLORS_
enum COLORS {
BLACK, /* dark colors */
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
DARKGRAY, /* light colors */
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
#endif
static int __BACKGROUND = 0;
static int __FOREGROUND = 7;
void
gotoxy(int x, int y)
{
COORD c;
c.X = x - 1;
c.Y = y - 1;
SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
}
void
clrscr ()
{
DWORD written;
FillConsoleOutputAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
__FOREGROUND + (__BACKGROUND << 4), 2000, (COORD) {0, 0},
&written);
FillConsoleOutputCharacter (GetStdHandle
(STD_OUTPUT_HANDLE), ' ',
2000, (COORD) {0, 0}, &written);
gotoxy (1, 1);
}
#endif
2. store the file in the include folder
3. when u want to use it in an app ... just say
#include <conio.c>
I prefer including stdlib.h and using system("CLS"); (My initals ;-) ). Saves having to include conio.h and conio.c
Curtis
as i said "possible" solution:) .... man this software is really good .... nice work guys:)
just wanted to add that system("CLS") or system("PAUSE") ... is a little bit slower to respond than and not as smmoth as clrscr() or getche()
.c files should be separately compiled and linked - not included. Only .h files should be included, and these should not contain any data instantiation or function definitions - only (extern) declarations.
This is more efficient from a compiler point of view, (it only compiles the modules that have changed), and if you have more than one module that includes the same .c files containing function code and/or data instantiation, then linker errors will occur.
You may be only writing single module apps at present, so do not see the problem - but such bad practices will bite you in the end.
Question: What are the Linux/Unix commands equivalent to Windows' CLS and PAUSE commands? Thanks!
qWake
FYI: I have found CLEAR as the Unix equivalent to Windows' CLS. But there doesn't seem to be an equivalent to PAUSE as a standard shell command in Unix...
qWake
FYI: I have found CLEAR as the Unix equivalent to Windows' CLS. But there doesn't seem to be an equivalent to PAUSE as a standard shell command in Unix...
qWake