Sponsored Content
Full Discussion: Xlib help - Array of Structs
Homework and Emergencies Homework & Coursework Questions Xlib help - Array of Structs Post 302744409 by Spiritvs on Friday 14th of December 2012 09:50:36 AM
Old 12-14-2012
Xlib help - Array of Structs

Hey guys!
First of all english is not my main language so sorry for any english mistakes.
Im from Portugal!

1. The problem statement, all variables and given/known data:

Im having a problema creating and array of structs for a work i need to do. (xLib)

2. Relevant commands, code, scripts, algorithms:

So i created a struct, that holds 4 ints:

X = X position
Y = Y postion
dimX = horizontal dimension
dimY = vertical dimension

this 4 ints represent a rectangle.

The struct:

Code:
typedef struct _blocks {
    int X, Y ,dimX, dimY;
} str_blocks;

So now i want to assign values to this int's, but since i dont want just one rectangle i want, for example 3, the best thing to do is to create an array of this struct right?

So for 3 rectangle:

Code:
str_blocks blocks[3];

blocks[0] = {50, 50, 150, 20};
blocks[1] = {200, 50, 150, 20};
blocks[2] = {300, 150, 150, 20};

So this doesnt work and i dont know why. ive been looking in the internet and
saw lots of examples where they declare the values like this, im obviously missing something...

Tried to assign value by value:

Code:
blocks[0].X = 50;
blocks[0].Y = 50;
blocks[0].dimX = 150;
blocks[0].dimy = 20;

blocks[1].X = 200;
blocks[1].Y = 50;
blocks[1].dimX = 150;
blocks[1].dimy = 20;

blocks[2].X = 300;
blocks[2].Y = 150;
blocks[2].dimX = 150;
blocks[2].dimy = 20;

3. The attempts at a solution (include all code and scripts):

I tried to use:

Code:
str_blocks blocks[3];

blocks[0] = {50, 50, 150, 20};
blocks[1] = {200, 50, 150, 20};
blocks[2] = {300, 150, 150, 20};

To give diferent values to the blocks.


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Im from Portugal anyway.

ESTG IPVC Portugal - Viana do Castelo
Engenharia da Computação Gráfica e multimédia.
Teacher name: João Raposo
www . estg . ipvc . pt

Last edited by Corona688; 12-14-2012 at 11:44 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

pipes + structs

heya got a small problem here. im trying to pipe eg: 'ls | more'. i have created a command line parser which separates ls and more into two commands. i have also created a struct, each struct has a command name, number of arguments, redirect_in, redirect_out, pipe_in, etc etc.... eg: struct... (0 Replies)
Discussion started by: mile1982
0 Replies

2. UNIX for Advanced & Expert Users

xlib error

Hello! Im running tight VNC on Red Hat Enterprise Linux 4.0. How can I increase the number of X clients that I can run in a VNC session?I need to run aproximately 500 programs in one VNC session, but at this time I can only 236 -> i've tryed to launch 250 xclock's in background and when it... (3 Replies)
Discussion started by: karpoand
3 Replies

3. UNIX and Linux Applications

vncserver xlib error

Hello! Im running tight VNC on Red Hat Enterprise Linux 4.0. How can I increase the number of X clients that I can run in a VNC session?I need to run aproximately 500 programs in one VNC session, but at this time I can only 236 -> i've tryed to launch 250 xclock's in background and when it... (0 Replies)
Discussion started by: karpoand
0 Replies

4. Programming

problems with drawing in x using xlib

Hi all, I'm currently learning xlib and I've encountered a bizarre mistake: function calls such as XDrawPoint, XDrawLine, etc., don't seem to work; a blank window with nothing in is appears. I believe this has something to do with the window manager I use, fluxbox. After checking the code and... (0 Replies)
Discussion started by: hydronium
0 Replies

5. Programming

Xlib simple program.

I don't know if it is right to ask you this. Can someone help me write a simple Xlib program,with button on it,and all that button do is switch 2 messages. I have tried and tried,but never get past Hello World. Can someone help me please? ---------- Post updated at 10:17 PM ---------- Previous... (2 Replies)
Discussion started by: megane16v
2 Replies

6. UNIX for Dummies Questions & Answers

Xlib Errors

Hi, I am handling user issues in my team. Users have their Unix session running on Citrix MFU. Recently, I was suppose to address a user issue which is as below: Gets the below error when tries to open nedit: Xlib: connection to ":165.0" refused by server Xlib: Client is not... (1 Reply)
Discussion started by: mspatil0037
1 Replies

7. Programming

[solved]help passing array of structs to function in c

this is my code to try and prinnt out a deck of cards. the print function worked when used inside main without being a function but now i cant get it to work as a function probably since i dont know how to pass a struct array in c. I gave it a shot but i keep getting an assortment of errors. The... (0 Replies)
Discussion started by: bjhum33
0 Replies

8. UNIX for Advanced & Expert Users

xlib and keyboard events

1. If there's some better place where xlib experts hang out, please tell me. Despite an assiduous search, I could not find an xlib reflector. 2. My actual question: In an xterm, I want to grab and process all keyboard events in a program running inside the xterm. For example, with my program... (5 Replies)
Discussion started by: N7DR
5 Replies

9. Programming

Xlib help - Array of Structs

Hey guys! First of all english is not my main language so sorry for any english mistakes. Second im a total beginner in programming, still i have a school work to do and i found a problem. Probably something easy to solve but it's driving me crazy. So i created a struct, that holds 4 ints: ... (1 Reply)
Discussion started by: Spiritvs
1 Replies

10. Programming

Xlib registering

hey, Im new to the linux world. Lately, I have tried to create a glx window with xlib, making it a popup window(fullscreen) so I set override_redirect to true. Im happy with the removed borders, but apparantly, the application doesnt show up in the left bar in ubuntu, neither when I press alt... (4 Replies)
Discussion started by: thedardanius
4 Replies
american-english-insane(5)					   Users' Manual					american-english-insane(5)

NAME
american-english-insane - a list of English words DESCRIPTION
/usr/share/dict/american-english-insane is an ASCII file which contains an alphabetic list of words, one per line. FILES
There may be any number of word lists in /usr/share/dict/. /etc/dictionaries-common/words is a symbolic link to the currently-chosen /usr/share/dict/<language> file. /usr/share/dict/words is a symbolic link to /etc/dictionaries-common/words, and is the name by which other software should refer to the system word list. See select-default-wordlist(8) for more information, and/or to change the currently- chosen word list. The directory /usr/share/dict can contain word lists for many languages, with name of the language in English, e.g., /usr/share/dict/french and /usr/share/dict/danish contain respectively lists of French and Danish words if they exist. Such lists should be coded using the ISO 8859-1 character set encoding. SEE ALSO
ispell(1), select-default-wordlist(8), and the Filesystem Hierarchy Standard. HISTORY
The words lists are not specific, and may be generated from any number of sources. The system word list used to be /usr/dict/words. For compatibility, software should check that location if /usr/share/dict/words does not exist. AUTHOR
Word lists are collected and maintained by various authors. The Debian English word lists are built from the SCOWL (Spell- Checker Ori- ented Word Lists) package, whose upstream editor is Kevin Atkinson <kevina@users.sourceforge.net>. Debian 16 June 2003 american-english-insane(5)
All times are GMT -4. The time now is 01:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy