Adding to an array in an external file, and adding elements to it.


Login or Register to Reply

 
Thread Tools Search this Thread
# 9  
Old 5 Days Ago
Quote:
Originally Posted by ignatius
Let me elaborate a little more on what i'd like to see... I'd like to be able to traverse the elements in the array with the arrow keys. That's essentially what i'm trying to do. I already have the code ready to accomplish this. I just need to be able to feed the function the name of the array. And that's it.
What prevents you from doing so?

What does this function look like?
# 12  
Old 5 Days Ago
This line right here:


Code:
 selection=barmenu(testarray,row,col,arraylength,width,menulength,3);

It obviously isn't the array that needs to be called.
# 13  
Old 2 Days Ago
Ok. I've made a lot of progress.

I'm having problems with this array now:

Code:
         const char *testarray[]={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"};

And this:

Code:
    selection=barmenu(testarray,row,col,arraylength,width,menulength,0);

Which does this:

Code:
pbtelnet(selection, "26");

Code:
pbtelnet

is a function to telnet to an address. The first argument is the hostname, the second is the port number, so, this iteration is telnetting to port 26 of the value of the "Zero" array element.

My question is, it works perfectly fine, but for some reason it telnets to 127.0.0.1. I'm wondering why?

Also, how do I change the value of said element ("Zero")? At this point in time it seems to be set to "0".
I'm wondering how do I change that?


BTW, if you're looking for the source code to the
Code:
 barmenu

function, my paste on pastebin is still there.

Last edited by ignatius; 2 Days Ago at 08:09 PM..
# 14  
Old 1 Day Ago
Why would it telnet to anything? I see that nowhere in your code.

This may be helpful:
Code:
arraylength=sizeof(testarray)/sizeof(char *); // Placeholder, only works with predefined arrays

Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Adding Two Array in shell script mukulverma2408 Shell Programming and Scripting 8 09-07-2017 05:19 PM
Solaris - Sendmail - Adding .com.gr in external senders e-mails Mcasim Solaris 2 08-11-2017 04:36 AM
Help reading the array and sum of the array elements nishantrefound Shell Programming and Scripting 1 08-13-2016 07:43 AM
Adding an element to a bash array with a variable LMHmedchem Shell Programming and Scripting 4 03-11-2015 10:00 AM
How can we assign value to an array variable from an external file? mukulverma2408 Shell Programming and Scripting 6 07-12-2012 04:31 PM
Adding results of a find to an array Fly_Moe Shell Programming and Scripting 2 07-28-2011 03:31 PM
Help in adding in csv file mariselvam UNIX for Advanced & Expert Users 1 05-13-2011 03:03 AM
Adding new lines to a file + adding suffix to a pattern hemo21 Shell Programming and Scripting 7 06-14-2010 12:19 AM
Problem adding into an array field!!! talk2pawee Shell Programming and Scripting 5 06-11-2009 02:39 AM
Adding external disk array to a live server sbk1972 Solaris 1 04-17-2009 10:42 AM
Adding array element in KSH Shoeless_Mike Shell Programming and Scripting 3 12-17-2008 03:43 PM
Search array elements as file for a matching string mkbaral Shell Programming and Scripting 1 09-18-2008 04:20 AM
adding existing disks to a 3510 array malcqv Solaris 2 12-21-2007 03:40 AM
Help on adding file sizes llsmr777 UNIX for Dummies Questions & Answers 1 09-18-2007 02:58 PM
Adding from a file int007 Solaris 2 03-22-2005 07:05 PM