Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help making manipulable variable Post 302754253 by Weavel37 on Thursday 10th of January 2013 10:46:10 AM
Old 01-10-2013
Help making manipulable variable

Hello, I'm a newbie in C, but i'm trying to make a file to configurate/manipulate variables of a C code.

I tried using int and extern int throught a header or another C code but it doesn't seems to work (even throught the makefile). I also tried (with XML) to put a data structure to hold the shared variables with the XML_SetUserData function to pass a pointer to this structure to the handlers.

Maybe i did something wrong, but i can't find where. Any help is welcome. Thanks.

---------- Post updated at 04:46 PM ---------- Previous update was at 03:41 PM ----------

So,here is code.h

Code:
#ifndef _CODE_H
#define _CODE_H
#include <stdio.h>
#include <stdlib.h>

#define X 1
typedef unsigned char X_Bool;
#define X_TRUE ((X_Bool) 1)
#define X_FALSE ((X_Bool) 0)
#define X_MODE ((X_Bool) 2)
#endif


then conf.c

Code:
int M;
M = 2;


and then code.c

Code:
#include <stdio.h>
#include "code.h"
extern int X;
extern int M;
int main(int argc, char *argv[]) {
while (1) {
printf("\n%s\n", M);
printf("\n%s\n", X);
printf("\n%s\n", X_MODE);
}


and then the compile
Code:
gcc code.c conf.c -o decode `pkg-config --cflags --libs gstreamer-0.10

I want to change variable throught code.h or conf.c for code.c but it fail. It seems to ignore it with no errors.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Making a variable equal a pattern

Hi, I would like to assign a pattern to a variable eg test8* or abc etc The problem I have is that when I assign the pattern to the variable, if any files within the current directory match the pattern then the variable will be evaluated to equal the filenames rather than the literal pattern.... (3 Replies)
Discussion started by: Bab00shka
3 Replies

2. Shell Programming and Scripting

Making a Directory

Hi everyone, Im trying to make a new directory based on a name given in a file called directory_file which contains the following content: garbage gargbage Directory: running more garbage gargbage more garbage gargbage more garbage gargbage So basically i have a shell script that... (3 Replies)
Discussion started by: nbvcxzdz
3 Replies

3. UNIX for Dummies Questions & Answers

making a variable as string

I am evaluating a variable from a database and storing it as inside. The value of the variable is alpha numeric.How can i make this a string type.Any functions for the same. (1 Reply)
Discussion started by: dr46014
1 Replies

4. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

5. Shell Programming and Scripting

Making script show command (e.g. copy) being executed and variable substitution?

When script is running you only see when some of the commands are not successfull. Is there a way to see which command are executed and to show the substitution of variables as every line is executed ? (3 Replies)
Discussion started by: gr0124
3 Replies

6. UNIX for Dummies Questions & Answers

Making a function

I am practicing making my own functions in bash for an upcoming exam. For this example, I want to print out a message and maybe add two numbers. What I would do then is: bash-3.2$ function practice { #code to print #code to add } This would be run using an input file, that would... (1 Reply)
Discussion started by: Midwest Product
1 Replies

7. UNIX for Advanced & Expert Users

Regarding help for making own OS

Dear Fellow, I want to make my own OS, Kindly suggest from where i should start. please help me out. (2 Replies)
Discussion started by: zaigham_tt
2 Replies

8. UNIX for Beginners Questions & Answers

Help me making this script

This script is executed whenever a new vehicle is added to the cycle-motor park of campus. The script asks for the following information about the car and adds a new line to the vehicle file.txt: name (name of an animal, unique identifier), color, mark, model, type (e.g., electrical, manual),... (2 Replies)
Discussion started by: andre2222
2 Replies

9. Shell Programming and Scripting

Help with making the output of a command a variable

I'm writing a script that goes something like this: #!/bin/bash zenity --list --checklist --title="Choose Packages to Install" --width="1000" --height="400" \ --column="Select" --column="Package Name" --column="Description" \ GIMP=$( " " GIMP "GIMP is a free and open source photo editor." ... (1 Reply)
Discussion started by: Defunct_Lizard
1 Replies
Locale::Language(3perl) 				 Perl Programmers Reference Guide				   Locale::Language(3perl)

NAME
Locale::Language - standard codes for language identification SYNOPSIS
use Locale::Language; $lang = code2language('en'); # $lang gets 'English' $code = language2code('French'); # $code gets 'fr' @codes = all_language_codes(); @names = all_language_names(); DESCRIPTION
The "Locale::Language" module provides access to standard codes used for identifying languages, such as those as defined in ISO 639. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639 two- letter codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying languages. The ones currently supported are: alpha-2 This is the set of two-letter (lowercase) codes from ISO 639, such as 'he' for Hebrew. This code set is identified with the symbol "LOCALE_LANG_ALPHA_2". This is the default code set. alpha-3 This is the set of three-letter (lowercase) bibliographic codes from ISO 639, such as 'heb' for Hebrew. This code set is identified with the symbol "LOCALE_LANG_ALPHA_3". term This is the set of three-letter (lowercase) terminologic codes from ISO 639. This code set is identified with the symbol "LOCALE_LANG_TERM". ROUTINES
code2language ( CODE [,CODESET] ) language2code ( NAME [,CODESET] ) language_code2code ( CODE ,CODESET ,CODESET2 ) all_language_codes ( [CODESET] ) all_language_names ( [CODESET] ) Locale::Language::rename_language ( CODE ,NEW_NAME [,CODESET] ) Locale::Language::add_language ( CODE ,NAME [,CODESET] ) Locale::Language::delete_language ( CODE [,CODESET] ) Locale::Language::add_language_alias ( NAME ,NEW_NAME ) Locale::Language::delete_language_alias ( NAME ) Locale::Language::rename_language_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Language::add_language_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Language::delete_language_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes man page. SEE ALSO
Locale::Codes Locale::Constants http://www.loc.gov/standards/iso639-2/ Source of the ISO 639 codes. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 1997-2001 Canon Research Centre Europe (CRE). Copyright (c) 2001-2010 Neil Bowers Copyright (c) 2010-2011 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-26 Locale::Language(3perl)
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy