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


ADVERTISEMENT

C# :: Adding More Than One Content To Scrollviewer

Apr 20, 2014

I'm trying to create an appointment time table.

I used a ListBox with each ListBoxItem representing 15 minutes. Now I want to add some kind of label/picture next to the Listbox to indicate the hours.

What I did was I got rid of the scrollbars and scrolling ability of the ListBox and I heightened to the max. THen I added it into a Scrollviewer to scroll up and down.

Now I also have a StackPanel with TextBlocks. Each TextBlock is an hour label.

I want to put that StackPanel into the Scrollviewer as well so it can scroll alongside the ListBox! But it seems the Scrollviewer can only have one "Content" in it.

A picture of my program:

Link to Dropbox pic

Here is my XAML so far:

(In this code my StackPanel is actually currently in Scrollview. I want to add my ListBox in as well...but I can't... />/>

<Grid>
<ScrollViewer Height="444" Width="350" Margin="834,145,10,182">
<StackPanel Height="1440" Width="101" HorizontalAlignment="Left" VerticalAlignment="Top">

[Code].....

View 3 Replies View Related

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 View Related

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++ :: 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++ :: Search For The Key Given A Content In Map?

Jan 7, 2014

In a C++ map, is there any way to search for the key given a content? Example:

I have this map:

map<int,string> myMap;
myMap[0] = "foo";

Is there any way that I can find the corresponding int, given the value "foo"?

cout << myMap.some_function("foo") <<endl;

Output: 0

View 3 Replies View Related

C :: Is There Way To See Binary Content Of File

Apr 3, 2013

I am using c to read and write contents of a file into other:

FILE *ptr;
status_t status;
uint32_t block_size, result;
uint32_t num_blocks;
char temp_buffer[1024];
}

[code]....

Is there way to see the binary content of this file.

View 2 Replies View Related

C :: Display Pointer Content

Oct 30, 2013

I wrote a code and I found a small problem with the display of the pointer

here is the code :

Code:

#include <stdio.h>#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {

[Code]....

View 5 Replies View Related

C++ :: How To Display Structure Content

Dec 17, 2014

I need to display all the content of the ( codedParams & modeParam ) in the next piece of code

struct SAOOffset {
SAOMode modeIdc; // SAOMode is an enumerator
Int typeIdc;
Int typeAuxInfo;
Int offset[MAX_NUM_SAO_CLASSES];
SAOOffset();
~SAOOffset();
Void reset();
const SAOOffset& operator= (const SAOOffset& src);

[Code] .....

View 1 Replies View Related

C :: Copy Variable Content To Clipboard?

Sep 3, 2014

In this example code:

Code:
printf ("
Type in 1st address: ");
scanf ("%x", &address1);
address1 = (address1 - number1) * 2;
printf ("
Result = %08X

", address1);

How can i copy the contents of var address1 onto the clipboard?

View 8 Replies View Related

C :: How To Write A Content Manager System (CMS)

Feb 17, 2014

how can i write a contact manager system(CMS) in c ?

View 2 Replies View Related

C++ :: RAM Disk And Pointer To Content In File

Mar 3, 2014

When we are using RAM DISK - the files are stored on the RAM. From what I understand (and saw many examples) in order to read data from file (the file which locate on the RAM) - I need to use the read function.

Is there a chance to get char* (or any pointer) to the content of the file without using the read function ?

If the file locate on the RAM, it seem that it is like I have a buffer on the RAM (like an array which was dynamic allocated) and in the case of a buffer on the ram -> we can use pointers to the data without reading all the data.

example:

class CDATA {
int nValue1;
int nValue2;
double dValue3;
double dValue4;
char achBuf[10];

[Code] .....

View 2 Replies View Related

C++ :: How To Put String Content Into Source Code

May 23, 2013

I'm trying to write a program that prompts the user to enter a math expression (i.e 2*x + x*x) and a value of x. Then generate the value of y. My real question is: Is there a way to put the content of a string into the source code?

Example:

string math_function;
double x, y;
cout << "Enter the function: ";
getline(cin, math_function);

[Code] .....

View 4 Replies View Related

C/C++ :: Vector Content Goes Away As Soon As Method Ends

Apr 2, 2015

I have this class, Prenumeratorius, it represents a subsriber in this context. Then I have a class Leidinys, which represents a newspaper:

class Leidinys {
private:
string kodas;
string pavadinimas;
double vienetoKaina;

[Code] .....

So in while loop it just reads data, Then I create Prenumeratorius object and store data in it, then I want to add it to correct place by using DėtiPrenumeratorių(), I will show it's content in just a moment. And the last method call - I just add element to another two way list of all subscribers.

So here is content of DėtiPrenumeratorių():

void LeidiniuSarasas::D/>ėtiPrenumeratorių(string kodas, Prenumeratorius &P) {
for(LeidiniuMazgas *dd = p; dd != NULL; dd = dd->Pirmyn()) {
if(dd->Imti().ImtiKodą() == kodas) {
dd->Imti().DėtiPrenumeratorių(P);
}
}
}

It just loops through all newspaprers and searches for the match. I actually tested this method, it works just fine, the problem is one step further:

As you can see, it calls another DėtiPrenumeratorių() method, this time that method puts Prenumeratorius in the vector I showed at the beginning.

The problem is, that when that method is over, vector's content dissapears, I debuged program and saw that, but I can't recognize what is wrong, I added & to all of my method's headers where it accepts that Prenumeratorius object. The same algorithm used to work with one way list.

View 4 Replies View Related

C++ :: Member Function To Shuffle Content?

Nov 14, 2014

Is there member functions for STL's like vector,list etc., to shuffle the content of that STL.

eg:

int arr[] = {1,2,3,4};
std::vector<int> v1(arr, arr+ sizeof(arr) / sizeof(int) );

now i need to shuffle the data randomly like

Now vector may contain {3,2,4,1} or {2,1,4,3} ...

I have taken vector as an example. let me know if there is any alternative way with other STL's

View 2 Replies View Related

C :: Appending Content In Middle Of A Text File

Sep 18, 2013

A user enters a query and other users reply to it. But it creates a problem here. After adding queries, if I wish to reply to query in between then it adds a redundant entry in file. 1st entry is the original query without reply and 2nd entry is the same query now with a reply added. I want only 1 entry of the query along with replies.Here is the code:

Code:

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include "var.c"
int check_count();
void add_query();
void add_reply();
}

[code]....

View 9 Replies View Related

C++ :: How To Read All Content From A Text File Into A String

Sep 24, 2013

I'm trying to read all content from a text file into a string. This is the code I'm using for it (I know there are other, maybe better ways to do it but I'd like to stick to this for now):

char* buffer;
std::string data;
FILE* fp = fopen("textfile.txt", "rb");
if (!fp) {
printf("Can't open file");

[Code] ....

So my problem is that I get an exception when I try to free the memory -> 0xC0000005: Access violation reading location 0x51366199

I even get the exception when I try to free it immediately after calloc() but why this is.

And if I use buffer = (char*)malloc(lSize); I don't get any exceptions.

So, why this fails and what I'm doing wrong.

View 14 Replies View Related

C++ :: How To Store Entire Content Of File In Variable

Jan 28, 2013

I would like to store the entire content of a file in a single c-string variable or in a standard string class variable. Is there a function that will do this for me? I am familiar with functions that get one character or one line at a time but I don't think I've encountered a function that gets the entire file. Does this function keep or disregard the end-of-line character? If no such function exists, I would write my own function to create and return such a variable.

View 4 Replies View Related

C# :: WPF / How To Check If Page Content Is Completely Rendered

Jan 13, 2014

In my program I have to load a page in a second window based on user's decision. This is how I do it:

case 1:
Page1 p1 = new Page1();
secondwindow.frame.Source = new Uri("p1.xaml", UriKind.Relative);
secondwindow.Show();
break;
case 2:
Page2 p2 = new Page2();
secondwindow.frame.Source = new Uri("p2.xaml", UriKind.Relative);
secondwindow.Show();
break;

The user should not be able to navigate between these two pages, and between choosing one or the other page, the user will have some interaction with the main window. For the user interaction with the main window, the second window gets hidden:

if (secondWindow != null)
{
secondwindow.Hide();
}

Now if the user selects the first page and and then the second page, when I show the second window, I can see the first page for a fraction of a second, and then second page gets rendered. I wanted to know if there is a way to make sure the rendering is complete before using:

secondwindow.Show();

View 5 Replies View Related

C# :: How To Represent A Table That Contains Dynamic Content In Header

Jun 2, 2014

I've attached an image that shows a basic table with dynamic content in the header.

Initially, I thought about using a datagrid. However, I can't use a datagrid because of the format of my data visually. The DataGrid would not allow me to have static and dynamic data inside my column headers.

You see anything I am displaying in brackets, {}, are being updated with results after I process some data in the backend. After the data analysis is done, the results are displayed based on an algorithm.

So, let's say for control1, for each family, it would indicate whether the data passed or failed. Then, in the rows themselves, it would update with choice 1 or choice 2 depending on the data generated.

So, the data that is in brackets shows properties being updated. I'm not sure what UserControl I can use to accommodate this kind of display.

View 13 Replies View Related

C/C++ :: Search In File And Extract Content Between 2 Strings

Jun 8, 2014

I need to develop a simple program, i have 2 variables (begin, end), and i need to search in a file, And extract the string between the Begin and the End variables to a new File, For Example:

my text file: file.txt:

some text here<StartHere>more text here</EndHere>text text

C++ Program:

//Declear 2 variables
strcpy_s(begin, string("<StartHere>").c_str());
strcpy_s(end, string("</EndHere>").c_str());

//And now, search in the Text file, And Extract the text between the begin string and the End string.
<...>

The Result should be: NewFile.txt with the content:

<StartHere>more text here</EndHere>

That's it!, Here is what i have for now:

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main() {
int ocurrences_count = 0;
int ocurrences2_count = 0;
char word[20]; //this array will save user input

[Code] ....

View 1 Replies View Related

C/C++ :: Copy Content Of File Into Structure Array

Feb 8, 2014

I am trying to write a program for a library system that allow stuff to add, remove, view and delete customer. i try to use file to store data and i open the file in mode read then i store then i put the content of the file into a structure. now the problem started it is only showing me haft of the content and here is the coding.

#include <stdio.h>
# include <windows.h>
# include <stdlib.h>
#include<string.h>
#include<conio.h>    
void search(int s,struct books eli[20]);
void view(int x,struct books eli[20]);    

[Code] .....

View 1 Replies View Related

Visual C++ :: Resizing Controls And Text Content

Sep 11, 2013

I have a SDI application that uses a CFormView class to create a window and this window has 2 buttons and 2 edit boxes.

I can resize this window, like minimize and maximize, but the controls all stay at the same place.

I know that it's possible to move the controls based on window size.

But what i want to do is, as the window is expanded the controls and it's text content to grow proportionally and same when the window is shrinked.

Is that possible to do? i.e., increase/decrease size of controls and texts per window size.

View 2 Replies View Related

C++ :: Getting A Large String Vector For File Content Manipulation?

Dec 10, 2013

I need a large string vector for file content manipulation.

v1.max_size() gives me 153 391 689.

But if I make a test by looping a vector pushing back strings it crashes around 16 - 26 000 000 though I still have a lot of ram (1GB left).

How come and why isn't vector size limited by ram instead?

View 11 Replies View Related







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