Sponsored Content
Top Forums Programming Splitting my program to multiple source files. Post 302119913 by the_learner on Friday 1st of June 2007 02:22:57 PM
Old 06-01-2007
Oh I think I now understand what you mean..

I should declare all global variables in a header file as extern. And define it in only one source file...

Something like this...

file1.c
Code:
#include "globals.h"
int a;
int b;
int c;
main()
{
     a = 1;
     b = 2;
     c = 3;
}

globals.h
Code:
extern int a;
extern int b;
extern int c;

file2.c
Code:
#include "globals.h"
func2()
{
     a++;
     b++;
     c++
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Splitting input files into multiple files through AWK command

Hi, I needs to split *.txt files from single directory depends on the some mutltiple input values. i have wrote the code like below for file in *.txt do grep -i -h "value1|value2" $file > $file; done. My requirment is more input values needs to be given in grep; let us say 50... (3 Replies)
Discussion started by: arund_01
3 Replies

2. Shell Programming and Scripting

splitting huge xml into multiple files

hi all i have a some huge html files (500MB to 1GB). Each file has multiple <html></html> tags <html> ................. .................... .................... </html> <html> ................. .................... .................... </html> <html> .................... (5 Replies)
Discussion started by: uttamhoode
5 Replies

3. Shell Programming and Scripting

help splitting a file into multiple files in bash

I have a file that logs multiple sessions. What I would like to do is split this file inclusive of the lines that include "starting session" and "shutting down" and ignore the data before and after the beginning of the first session and the end of the last session. The output files can be called... (2 Replies)
Discussion started by: elinenbe
2 Replies

4. Shell Programming and Scripting

splitting a file (xml) into multiple files

To split the files Hi, I'm having a xml file with multiple xml header. so i want to split the file into multiple files. Test.xml --------- <?xml version="UTF_8"> <emp: ....> <name>a</name> <age>10</age> </emp> <?xml version="UTF_8"> <emp: ....> <name>b</name> <age>10</age>... (11 Replies)
Discussion started by: sasi_u
11 Replies

5. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

6. UNIX for Dummies Questions & Answers

Splitting multiple files in a folder

Hello, I am new to UNIX etc and am trying to split a large number of files, all with the extension .fas in the same folder, into smaller files wherever a string of 5ns occurs. So this file: >File1.fas nnnnnaaaaaattgattttctcagtatcgacgaatatggcgcagaaagttgaataa ... (1 Reply)
Discussion started by: Bryony
1 Replies

7. UNIX for Dummies Questions & Answers

Splitting up a text file into multiple files by columns

Hi, I have a space delimited text file with multiple columns 102 columns. I want to break it up into 100 files labelled 1.txt through 100.txt (n.txt). Each text file will contain the first two columns and in addition the nth column (that corresponds to n.txt). The third file will contain the... (1 Reply)
Discussion started by: evelibertine
1 Replies

8. Shell Programming and Scripting

Splitting a single file to multiple files

Hi Friends , Please guide me with the code to extract multiple files from one file . The File Looks like ( Suppose a file has 2 tables list ,column length may vary ) H..- > File Header.... H....- >Table 1 Header.... D....- > Table 1 Data.... T....- >Table 1 Trailer.... H..-> Table 2... (1 Reply)
Discussion started by: AspiringD
1 Replies

9. Shell Programming and Scripting

Splitting file into multiple files and renaming them

Hi all, Newbie here. First of all, sorry if I made any mistakes while posting this question in terms of rules. Correct me if I am wrong. :b: I have a .dat file whose name is in the format of 20170311_abc_xyz.dat. The file consists of records whose first column consists of multiple dates in... (2 Replies)
Discussion started by: chanduris
2 Replies

10. Shell Programming and Scripting

Script for splitting file of records into multiple files

Hello I have a file of following format HDR 1234 abc qwerty abc def ghi jkl HDR 4567 xyz qwerty abc def ghi jkl HDR 890 mno qwerty abc def ghi jkl HDR 1234 abc qwerty abc def ghi jkl HDR 1234 abc qwerty abc def ghi jkl -Need to split this into multiple files based on tag... (8 Replies)
Discussion started by: wincrazy
8 Replies
globals(3U)						    InterViews Reference Manual 					       globals(3U)

NAME
globals - Unidraw global constants, types, instances, and functions. SYNOPSIS
#include <Unidraw/globals.h> DESCRIPTION
Several constants and types are used throughout the Unidraw library. It also provides global access to one-of-a-kind instances such as the unidraw object as well as shared graphics resources. Finally, there are several global functions for common data manipulations. All of these are declared one file for inclusion into other files where they are needed. CONSTANTS
static const int CHARBUFSIZE Size of standard character buffer. static const int HANDLE_SIZE Size of selection handles, in pixels. static const char MARK[] String that delineates data boundaries in the ASCII representation that Catalog generates. Used for error checking. static const int PIN_RAD The radius of a pin, used in its default graphical representation, in pixels. static const int SLOP Tolerance within which a hit on a graphical object will be detected, in pixels. TYPES
enum DragConstraint Enumerates orthogonal ways in which cursor movement may be constrained, usually during direct manipulation. Possible values include None, XFixed, YFixed, XYEqual, HorizOrVert, or Gravity. enum Mobility Enumerates the three possible component mobilities: Fixed, Floating, or Undef (undefined). typedef unsigned Orientation Specifies two kinds of orientation: Portrait or Vertical (synonymous), and Landscape or Horizontal (synonymous). enum TransMethod Enumerates the three possible transmission methods for connectors: In, Out, or InOut. typedef unsigned long ClassId Type for representing unique class names for catalog-managed objects. INSTANCES
extern Unidraw* unidraw extern CSolver* csolver The global unidraw and csolver objects. These and all other global instances are initialized automatically. extern PSColor* psblack extern PSColor* pswhite extern PSPattern* pssolid extern PSPattern* psclear extern PSPattern* psnonepat extern PSBrush* pssingle extern PSBrush* psnonebr extern PSFont* psstdfont Predefined graphics resource objects. The None operation on psnonepat and psnonebr returns true. extern Graphic* stdgraphic A FullGraphic instance with its graphics state set to the global values listed above, excluding psnonepat and psnonebr. FUNCTIONS
extern void NormalRect(Coord& l, Coord& b, Coord& r, Coord& t) Given two coordinate pairs (l, b) and (r, t), it checks whether l < r and b < t. If not, it swaps the values in the offending inequalities. This function is useful for ensuring that a rectangle is defined by its lower-left and upper-right vertices. extern void GetLine( const char* buf, int len, int beg, int& end, int& size, int& nextBeg ) This function is convenient for extracting lines from a buffer with a minimum of additional math operations. Given a buffer of char- acters buf of length len, search for the first newline character (or the last character in the buffer) after the character at index beg; return the newline's position in end, the size of the run of text terminated by a newline (end + 1 - beg), and the index with which to begin a search for the next newline character (nextBeg). extern void GetAlignmentPoint( Graphic*, Alignment, float&, float& ) Return the point (in floating point canvas coordinates) on a graphic corresponding to the given alignment. For example, to obtain the coordinates of the lower-left of a rectangle graphic, specify the graphic and a BottomLeft alignment. extern void Ref(Resource*) Call the Reference operation on the given instance of a resource subclass if the pointer is non-nil. extern char* strnew(const char*) Duplicate the given null-terminated string, creating a buffer of the appropriate size and returning the null-terminated result. SEE ALSO
CSolver(3U), Catalog(3U), Graphic(3U), GraphicView(3U), Pin(3U), Resource(3I), Unidraw(3U), InterViews(3I), pspaint(3U) Unidraw 30 July 1990 globals(3U)
All times are GMT -4. The time now is 07:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy