03-16-2011
Quote:
Originally Posted by
omega666
if i declare both but don't input any variables what values will the int array and file pointer array have on default
If they're stack variables, then undefined. Their contents may depend on your system, compiler, and moon phase. In short: don't use them until you set them somehow.
Quote:
and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what?
Define 'defaults'. If you want 0, set them to 0. If you want 37, set them to 37. If you want NULL, set them to NULL (which just amounts to 0 anyway, but is better for pointers...)
10 More Discussions You Might Find Interesting
1. Programming
Ok this is probably pretty easy but I'm stuck.
My program reads the contents of a txt file and stores the string into a char array called buff. The contents of the text file is a string of a txt file name. So basically buff has this value "file.txt\0". The last part is the null character. I want... (3 Replies)
Discussion started by: johnsonmj
3 Replies
2. Shell Programming and Scripting
Ok; here is the code
INCREMENT=0 #Final Count
MATCH=0 #Treated as a Boolean
declare -a LINEFOUR #Declared Array
for FILE in $DIR; do # DIR was declared earlier
test -f $FILE && (
TEMP=(sed -n '4p' $FILE) #How do I assign the fourth line of the file to TEMP? This doesn't... (1 Reply)
Discussion started by: Asylus
1 Replies
3. Shell Programming and Scripting
Hi,
I am trying to use arrays in my script but can not seem to get it to work.
I have a file called sections, this contains headers from a tripwire log file, separated by "@" but could be "," if easier
The headers will be used to cut sections from the log file into another to be mailed.
... (5 Replies)
Discussion started by: pobman
5 Replies
4. Web Development
PHP question...
I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names.
So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc
So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies
5. UNIX for Dummies Questions & Answers
Dear All,
I'm porting my scientific program from 32 to 64 bit system
(use gcc, CentOS) and feel myself absolutely confused
after reading general internet advices for that. Could you help me,
please.
The question is:
can I use "old style" on 64 bit:
--------
int * myIntArray;
... (3 Replies)
Discussion started by: German1234
3 Replies
6. Shell Programming and Scripting
Hi there, i have been trying different methods and i wonder if somebody could explain to me how i would perform a comparison on two arrays for example
my @array1 = ("gary" ,"peter", "paul");
my @array2 = ("gary" ,"peter", "joe");
I have two arrays above, and i want to something like this... (5 Replies)
Discussion started by: hcclnoodles
5 Replies
7. Shell Programming and Scripting
Hi all,
I have a file that contains many lines, but only a few are of my interest, so I'm cutting it with grep + awk, and the result I get is for example
line 0
line 1
line 2
line 3
line n
Now I want to store each line in an array "cell" so I can use it later calling to
${array},... (2 Replies)
Discussion started by: TuxSax
2 Replies
8. Shell Programming and Scripting
hi all, i have a data file that contains 2 columns, names and numbers. i need to read names in to a an array call names and numbers in to an array call numbers. i also have # and blank lines in my dat file and i need to skip those when i read the dat file. how do i do this? btw, my column 1 and... (3 Replies)
Discussion started by: usustarr
3 Replies
9. Shell Programming and Scripting
Hi, im new to shell scripting. i have a query for which i have searched your forums but coulndt get what i need.
i have a file that has two records of exactly the same length and format and they are comma seperated. i need to save the first and the second columns of the input file to 2 different... (11 Replies)
Discussion started by: atikan
11 Replies
10. UNIX for Dummies Questions & Answers
Hi guys
Let me explain at first what I'm trying to do. My input file looks like this.
1280
Surfaces
Pt 0.00000000000000 0.00000000000000 0.00000000000000
Pt 2.81138845918055 0.00000000000000 0.00000000000000
Pt 5.62277691836110 0.00000000000000 ... (5 Replies)
Discussion started by: saleheen
5 Replies
LEARN ABOUT DEBIAN
cgigetfiles
cgiGetFiles(3) Programmer's Manual cgiGetFiles(3)
NAME
cgiGetFiles - Returns a list of CGI file variables
SYNOPSYS
#include <cgi.h>
char **cgiGetFiles (s_cgi *parms);
DESCRIPTION
This routine returns a NULL terminated array of names of CGI file variables that are available. Details are provided with the cgiGet-
File(3) function. To free the memory allocated for the array use cgiFreeList(3).
RETURN VALUE
On success a NULL terminated array of strings is returned. The last element is set to NULL. If an error occurred or if no files variables
are available NULL is returned.
AUTHOR
This CGI library is written by Martin Schulze <joey@infodrom.org>. If you have additions or improvements please get in touch with him.
SEE ALSO
cgiGetFile(3), cgiGetCookies(3), cgiGetVariables(3), cgiFreeList(3), cgiDebug(3), cgiInit(3).
CGI Library 6 April 2008 cgiGetFiles(3)