Sponsored Content
Top Forums Programming Missing Logic Looping Through Switch Statement Post 303022577 by Azrael on Monday 3rd of September 2018 03:15:07 AM
Old 09-03-2018
Maybe I should have posted more code. This is the function that is being called each time:

Code:
// Pull random array element to be called for each character.
int ranit(int char_array[]) {
    srand ( time(NULL) );
    int RandIndex = rand() % DATA_SIZE;

    return char_array[RandIndex];
}


It selects a random in the array being called and works.

In another function all the arrays mentioned have a random number with /dev/urandom generated and assigned to each element.

Sorry if I was vague. I just have about 600 lines of code now and was trying to narrow down what was relevant to fit here. My apologies.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using getopt with a switch statement

hi all, i have been trying to get a script working that can take in more than one option using getopt. But for some reason, even when i type in a covered option, it skips directly to my error message of "no match." Any ideas of what might be wrong? set - 'getopt frd*: $*' for i in $* do... (6 Replies)
Discussion started by: gammarays
6 Replies

2. Programming

Comapilation error with Switch statement

Hello , How to resolve below compilation error.activity_type is a member of structure and the output from databse will be stored in structure.Expected output wil l be either D or N or C . sample struct format: struct a{ char acAtivity_type; } code: switch (a->activity_type)... (1 Reply)
Discussion started by: jagan_kalluri
1 Replies

3. Shell Programming and Scripting

Tcl switch statement

I am just learning Tcl and there are few things about it that is perplexing me. I have a question about the switch statement. Why are these two switch statements giving me different results? $ cat test_switch.tcl #!/usr/bin/tcl set foo "abc" switch abc a - b {puts "No. 1"} $foo {puts... (2 Replies)
Discussion started by: SFNYC
2 Replies

4. Shell Programming and Scripting

Missing Assigned Variable within logic operator

Hey , I'm trying to perform the following command, however it cannot read the variable assigned earlier. I'm not sure why this happen. Please help thanks while : do echo "what's ur name? (if none just press )" read name changeName = echo $name | sed "s/on/ey/" echo $changeName #this... (8 Replies)
Discussion started by: sexyTrojan
8 Replies

5. Shell Programming and Scripting

Something is wrong with this switch( case statement.

I started writing a script to save the files from a camera I got the other day, which mounts in /Volumes , and I got into it and started building this menu. The only problem is that the switch case is coming up as a syntax error at the parenthesis after a case. Here is the code: while : do ... (2 Replies)
Discussion started by: snakemasterAK
2 Replies

6. Emergency UNIX and Linux Support

Looping using cut statement

i want to create loop for below mentioned A1=`echo $obj1 | cut -d "," -f3` A2=`echo $obj1 | cut -d "," -f4` A3=`echo $obj1 | cut -d "," -f5` A4=`echo $obj1 | cut -d "," -f6` A5=`echo $obj1 | cut -d "," -f7` A6=`echo $obj1 | cut -d "," -f8` A7=`echo $obj1 | cut -d "," -f9` A8=`echo $obj1... (3 Replies)
Discussion started by: pasricha.kunal
3 Replies

7. Shell Programming and Scripting

Logic needed to recursive looping in the script

Hello i have a requirement where in a file i will get string. The length could be from 1 to 20. if the string is less than 6 characters ( ex: ABCD) . i need to append 'X' on right hand side to make it 6 characters (ex: ABCDXX). if suppose i get the same string from the file as ABCDXX then i... (5 Replies)
Discussion started by: dsdev_123
5 Replies

8. Programming

Passing arguments from command line to switch case statement in C

Hi Am pretty new to C.. Am trying to pass the arguments from command line and use them in switch case statement.. i have tried the following #include <stdlib.h> main(int argc, char* argv) { int num=0; if ( argc == 2 ) num = argv; printf("%d is the num value",num); switch ( num ) ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

9. UNIX for Dummies Questions & Answers

Looping Logic, Need to implement

I need to implement a looping logic. If then Go to /path1/file* Get all the filename starting with file* and store it in a array count file number and store it in variable like run Ex: I found 3 file with starting file* so my run = 3 means my loop should run three time May be... (1 Reply)
Discussion started by: Nsharma3006
1 Replies
devswmgr(8)						      System Manager's Manual						       devswmgr(8)

NAME
devswmgr - utility to manage the device switch database SYNOPSIS
/sbin/devswmgr [-option [parameter]] OPTIONS
Displays the following information about the device switch database: Whether a device switch database was read from the primary file or from a backup file The number of entries that are in the device switch table Displays the major numbers that have been reserved by all drivers, a named driver, or an instance of a named driver. A driver that requires more than one entry in the device switch table uses a unique instance number to reference each of its device switch table entries. Displays help for the devswmgr command. Releases all the major numbers for a device driver if just the driver name is specified. Releases one major number for a device driver if the NAME and the INSTANCENUM of the driver are speci- fied. DESCRIPTION
The devswmgr command helps you manage the device switch table by displaying information about the devices drivers in the table. You can also use the command to release device switch table entries. Typically, you release the entries for a driver after you have unloaded the driver and do not plan to reload it later. Releasing the entries frees them for use by other device drivers. EXAMPLES
The following example shows that a device switch table was loaded from the primary device and that there are 70 entries in it: % /sbin/devswmgr -display Device switch information device switch database read from primary file device switch table has 70 entries The following example shows the major numbers in the device switch table that have been reserved for the driver named cam_disk: % /sbin/devswmgr -getnum driver=cam_disk Device switch reservation list (*=entry in use) driver name instance major ------------------------------- -------- ----- cam_disk 1 8* FILES
The file that manages the device switch databases The primary device switch database file The backup device switch database file SEE ALSO
Commands: scsimgr(8) devswmgr(8)
All times are GMT -4. The time now is 07:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy