C++ :: How To Start Using Ncurses

Sep 3, 2013

It's written here: URL....But those links don't work. I can't understand how to start programming using ncurses.

View 9 Replies


ADVERTISEMENT

C++ ::  NCurses Outputting Vectors

May 19, 2013

The following code works perfectly with "normal" C++

#include <iostream>
#include <vector>
int main() {
std::vector <std::string> hello {

[Code] ....

This prints "HELLO" on the screen. A function a bit more like NCurses is:

for (std::vector <std::string>::const_iterator it = hello.begin(); it != hello.end(); it++) {
std::string temp = *it;
std::cout << temp.c_str() << std::endl;
}

This still works with "normal" C++. Now, how do I get this working with NCurses? I tried

#include <curses.h>
#include <string>
#include <vector>
int main() {
initscr();

[Code] ....

But this just gives me an empty screen.

View 2 Replies View Related

C :: Getting Started On Rogue Using Ncurses Library

Feb 16, 2013

I've been assigned to program rogue using the ncurses library, which will need

1. File I/O
2. String parsing
3. User input (h,j,k,l)
4. Room drawing

And Where i can start with this program?

View 4 Replies View Related

C++ :: Adding Content To Window Using Ncurses

Aug 12, 2013

I'm makeing a card game with ncurses. I have all the card and player objects in order but i'm stuck trying to get the gui to work.

I'm using multiple windows for different players deck and pile. Now to the problem: I can get all the windows to show with borders in the console but i can't get any content printed in the windows and I rally can't see why!?

I have been reading the guide on [URL] but I don't get any further on the problem right now.

PS. the complete code incl. Makefile can be found at:
github.com/DanBrehmer/cardGame
#ifndef GUI_H
#define GUI_H
#include <ncurses.h>

[Code]....

View 3 Replies View Related

C++ :: Ncurses - Highlighting A Line Of Characters On Screen

Oct 25, 2013

I am writing a program using ncurses that needs a function to highlight a line of characters on the screen. I started writing this function that took the x & y coordinates of a character on the screen and the length of characters after that to highlight. Whilst doing this I noticed that if I highlighted the last character in a row (maxX-1 in my example) it highlighted that character (as expected), and if I highlighted just the character before that (maxX-2) it also works. But if I do both, it highlights the whole row/line. Also, if there are characters in those spaces other than the 'space' character it works too, but for my program I need to be able to highlight empty spaces as well.

To highlight I am using inch() to get the character and addch() to print it because I am using some alternate characters that chgat() replaces with normal characters.

#include <ncurses.h>
int main(){
initscr();
start_color();
use_default_colors();
curs_set(0);
noecho();

int maxX=0, maxY=0;

[Code] ....

View 3 Replies View Related

C++ :: Make Terminal Screen Bigger In NCurses Program?

Jun 29, 2013

I wanted to make the terminal screen bigger in my NCurses program. Let's say if the defaults are 25 LINES and 80 COLS, I want to set them to 40 LINES and 120 COLS.

I've tried resizing all windows, but that did not work, because the actual terminal (console) was not resized. Then I found functions resizeterm and newterm, but they did not work. As far as my understanding goes resizeterm only updates NCurses information with the current configuration, while the window itself is not actually modified.

NCurses man page wrote:The function resizeterm resizes the standard and current windows to the specified dimensions

If I haven't made myself clear ( I sometimes make a mess of things... ), another example would be that I want my program to be fullscreen when I start it. Is this possible? It should be, I found a fullscreen NCurses program once, but the code was too confusing for me to understand.

Having read about things like SIGWINCH, I assume you must define a method for resizing the terminal screen yourself, I don't know where to start?

View 11 Replies View Related

C Sharp :: Why Start From 1 Not From Zero

Jul 16, 2013

char []c =null;
c=new char[1]; 

why star from [1] not from [0]???

View 1 Replies View Related

C :: Parallel Port Where To Start

Jan 1, 2014

I started writing in c because I want to control relays with the parallel port, or anything else. Doesn't really matter what I use I just need to know where to start. Trying to send and receive data from the outside world with c programming on a GNU/Linux os? If so any good some what up to date resources online?

View 5 Replies View Related

C :: Start Stop Watch

Feb 25, 2013

I'm new to C programming and am quiet lost, create a program that takes a start and stop time and prints the passed, or show me where I can find the information needed?

View 6 Replies View Related

C :: Getting A Loop To Return To Start

Feb 21, 2013

How would I go about getting a loop to return to the start?

View 2 Replies View Related

C++ :: How To Start Writing Game App

Oct 23, 2013

How do i start writing Gaming app using C++. What is the environment required. I have mingw compiler installed on Windows8.

View 4 Replies View Related

C++ :: How To Start A Printer Queue

Nov 30, 2014

Write a program to simulate a printer queue (priority queue or heap – Bentley article has code) where 3 printers are “fed” by this queue. Each print job has an unchanging priority and higher priority jobs go first (although once started, a job isn't stopped to let a higher one go). For each unit of time, there is a 26% probability that a job will be added to the queue and all jobs take 8 time units to complete. Print job priorities are between 5 and 100. The queue opens 20 time units prior to the start of printing for adding print “jobs”. A print “day” is 1000 time units. The output from your program is:

1) A list of jobs completed with their priorities for each printer

2) A list of jobs not completed (if any).

#include <iostream>
#include <cstdio>
#include <cstring>

[Code].....

View 1 Replies View Related

C++ :: Add Prompt At The Start Of Program?

Jan 28, 2013

i want to add a prompt at the start of my program which ask a user to enter its password wat will be its syntax it is confusing me alot i have written this code but its gving me a problem

int security(char *num)
{
char pass[10];
ifstream file("pass.txt", ios::in);

[Code].....

View 3 Replies View Related

C++ :: Random Value At Every Start Of Program

Dec 29, 2013

My motive is to get random variable at every start of program. So it does not show same sequence when it run again and again ....

Code:
int main() {
srand( time ( NULL ) );
cout<<rand();
}

When I run this program in code::block the following program is opening with error in new tab called TIME.H

Code:

#ifndef_TIME_H_
#define_TIME_H_
/* All the headers include this file. */
#include <_mingw.h>

#define __need_wchar_t
#define __need_size_t
#define __need_NULL
#ifndef RC_INVOKED
#include <stddef.h>
#endif/* Not RC_INVOKED */

[Code] .....

View 5 Replies View Related

C++ :: Getting Random Variable At Every Start Of Program

Dec 29, 2013

My motive is to get random variable at every start of program. So it does not show same sequence when it run again and again

Code:
int main(){
srand( time ( NULL ) );
cout<<rand();
}

When i run this program in code::block the following program is opening with error in new tab called TIME.H

Code: /* * time.h

* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Date and time functions and types.
*
*/

[Code] ....

View 8 Replies View Related

C++ :: Finding Names That Start With A Certain Letter

May 30, 2013

I am doing a homework assignment. I do not want the complete answer, just a hint. I have to load a file of names into an array, display the names, then sort the names alphabetically, display them again, then list how many names start with certain letters. I have everything done but how to display how many names start with a certain letter.

Here are the names:

Collins, Bill Smith, Bart
Allen, Jim
Griffin, Jim
Stamey, Marty
Rose, Geri
...........

And here is the code I have so far.

Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <algorithm>

[Code] ....

View 5 Replies View Related

C :: 0 Being Inserted At Start Of Linked List

Feb 14, 2013

I'm poking around with doing a few Haskell-like functions for linked-lists. Take, drop and so on.I've done the code below. The problem is that it mysteriously inserts a 0 at the start of the list.

Code:

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>
#include <malloc.h>
}

[code]....

View 5 Replies View Related

C++ :: How To Start Coding Audio Synthesizers

Mar 20, 2013

I'm interested in learning how to write the software for audio synthesizers. a friend of mine started on the hardware side for them and, as i have no experience with this type of code.

View 7 Replies View Related

C++ :: How To Set Auto Start Parameters For Program

Nov 14, 2014

Right now I am trying to make an alarm clock type program that will start on login and will go off when a certain time is reached. I also want to set a password that will prevent system use until the correct password is entered into the program's input. What functions will I need and how are they used?

View 1 Replies View Related

C/C++ :: Sum Up All Numbers Between Start And End And Compare This Sum To 1000

Oct 7, 2014

Sum up all the numbers between start and end. Lastly compare this sum to 1000.

--so i got the first part, but how to compare the sum to 1000.

View 3 Replies View Related

C/C++ :: Timer Will Start From Its Previous Value Instead Of Its Initial Value?

May 8, 2014

I am making a product and in which i use a timer. I want when the product is being start the timer will run and when the product is off the timer will stop. If i again start the product the timer will start from its previous value.

I have problem that the timer start from its initial when i start my product.

View 7 Replies View Related

C++ :: Why Start Variable Names With Underscores

May 1, 2012

I am looking at some C++ code that has many variables that start with underscores. Why? What's the point? I know in Python its a way to keep them private, but I don't understand why we would do that in C++ when we can just make something private.

View 14 Replies View Related

C :: How To Make Script Start Over Or Exit On Y / N Prompt

May 19, 2013

How to write a simple script to convert F to C. That was easy enough once I read about how C treats the math of 5/9 being less then 1 thus converts to 0. Fixed that issue and the code works great.

I find it a useful tool and would like to, way outside of the scope of the homework mind you, figure out a way to get the script to restart if a [Yy] answer is provided at the end of the script. All other responses result in return(0).

I only have limited knowledge in BASH scripting. In BASH i would have just placed the int main(void) {foo} into a single function then created a simple if/then test after the function is called.

Reading up on functions in C, they do not work in the same way I would like to treat them from BASH. understandable this is not BASH.

then i started looking into do/while loops. On an other forum someone pointed out the possibility of using fgets as part of the challenge response. Now when I try to compile the code im getting an odd result. for some reason the compiler seems to think that my character string(or is it an array) is an integer...

Code:
/* 5. Write a program to convert a temperature in degrees Fahrenheit to degrees Celsius. *///##########################################################
// Created by Raymond L. Brunkow
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 or version 3 of the
// license, at your option.
//

[Code] ....

//above is were the homework ends, below is what im trying to do now.
/* Prompt for new input */
printf("
Would you like to enter a new temperature [Y]es or [N]o? ");
fgets( BUFFER, sizeof(BUFFER), stdin );
}
while ( sscanf( BUFFER, "%1s%*1s", ANS ) != 1 || strchr( "YyNn", *ANS ) == NULL );
return(0);
}

This results in the following error:

Code:
$ gcc -o hw_1_5.v2 hw_1_5.v2.c
hw_1_5.v2.c: In function "main":
hw_1_5.v2.c:52:
warning: passing argument 1 of "fgets" makes pointer from integer without a cast There is no integer there to be passed.

View 10 Replies View Related

C++ :: How To Start Counting Time When Program Starts

Apr 7, 2013

I want to know if there is a function or library that starts counting time when the program starts. Because I'm making a program that is dependent on time.

Pseudo code

time starts
if ( seconds % 2 == 0 ) {
counter++;
}

View 2 Replies View Related

C++ :: Builder Application Start With Administrator Rights?

Jun 5, 2013

I would need to know how to make the c++ builder application to be started with administrator rights (it's common behaviour for installers - when it is started, it asks for administrator rights).

View 4 Replies View Related

C# :: Switch To End Or Start Of Array Depending On Conditions?

Apr 1, 2015

I have a seat allocation algorithm for an airplane 30 x 6 seats. The plane is 'split' front (1 - 15) and back (16 -30), right (A,B,C) and left (D,E,F). I am placing passengers in window seats front right centre (15A) first then back left centre (16F) followed by (15F) followed by (16A). This will continue for single passengers middle seats then aisle.

Another part of the algorithm is to ensure parties >2 or <=6 to sit together in an empty row, if not possible the party will be split as to not have a person in the party sitting alone firstly. i.e. 6 is 3 + 3 or 2 + 2 + 2 or 4 + 2 or 3 + 2 + 1 or 4 + 1 + 1 or 3 + 1 + 1 + 1 and so.

I have got it working for one person but seating two people is a bit more difficult. I am trying to get 15A,15B then 16E,16F then 16A,16B then 15E,15F then 16C 16D and 15C 15D.

This code only allocates passengers 15 A 15B then 15C 15D then 15E 15F

//seat allocation for two people
public bool[,] seatTwoPerson(bool[,] seatArray, int startCol, int endCol, int directionX, int startRow, int endRow, int directionY)
{ //loop through seatArray section determined by parameters
//for (int col = startCol; directionX < 0 ? col >= endCol : col < endCol; col += directionX)

[code].....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved