Sponsored Content
Top Forums Programming Comapilation error with Switch statement Post 302259988 by jagan_kalluri on Wednesday 19th of November 2008 12:04:52 PM
Old 11-19-2008
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[2];
}



code:
switch (a->activity_type) {

case 'D':
strcpy(xactivity, "Deleted");
break;
case 'N':
strcpy(xactivity, "New_Device");
break;
case 'C':
strcpy(xactivity, "Change");
break;
default:
strcpy(xactivity, "UNKNOWN ");
break;
}


Error:



rpt13.c: In function `do_rpt':
rpt13.c:344: switch quantity not an integer
*** Error code 1
make: Fatal error: Command failed for target `rpt13.o'
 

10 More Discussions You Might Find Interesting

1. IP Networking

Error with ifconfig when attempting to switch to 10baseT

In Darwin, when typing "ifconfig en0 media 10baseT/UTP mediaopt half-duplex" I recieve the error message "ifconfig: SIOCSIFMEDIA: Operation not permitted". The same thing occurs when I sudo the command. Any suggestions? Thanks... (1 Reply)
Discussion started by: tkarrde
1 Replies

2. 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

3. Solaris

Conflicting 'typedef' error - Which gcc switch to use?

I am using gcc3.3.5 on solaris2.7. Its a 64 bit compilation I am compiling a file 'plugin.cpp'. It includes mach.h and the complation gives the following error. ----------------------------------------------------------------- mach.h error: conflicting types for `typedef vx_u32_t... (0 Replies)
Discussion started by: amitc
0 Replies

4. 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

5. Shell Programming and Scripting

how to access console of a switch having rj45 on switch side to db 9 female on pc side console cable

hi, how to access console of a switch having rj45 on switch side to db 9 female on pc side console cable which needs to be connected to one console server having rj11 on its side and db 9 female on other end.i.e. on switch side,console cable has rj45 and db 9 pin female connector on other side of... (1 Reply)
Discussion started by: pankajd
1 Replies

6. 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

7. Shell Programming and Scripting

Error while executing switch case for find and replace specific file. Help Me...

case "$inputs" in sapte) find /pools/home_unix/sapte/work/models/model -name "*.xml" exec rm -i {} \;; ckm1) find /pools/home_unix/ckm1/work/models/model -name "*.xml" exec rm -i {} \;; I am getting error like as below. ./menu1.sh: line 144: syntax error near unexpected token `)'... (4 Replies)
Discussion started by: lathigara
4 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. Shell Programming and Scripting

Switch user terminal error

Hello All, Here I am trying to login a Linux machine as admin user from a Solaris box.. & then switch to root user.. Code I use: ssh admin@<IP> << END su - root << A echo "Hello I am logged in as root" exit A exit END But the error I get.. su: must be run from a... (3 Replies)
Discussion started by: ailnilanjan
3 Replies

10. Programming

Missing Logic Looping Through Switch Statement

Having trouble with the logic when looping over this switch case again: for (j = 0; data != 0; j++){ switch(data){ case 'c': output = ranit(r_brace_array); break; case 'h': output = ranit(pipe_array); break; ... (6 Replies)
Discussion started by: Azrael
6 Replies
buf(9s) 																   buf(9s)

NAME
buf - General: Describes arbitrary I/O SYNOPSIS
---------------------------------- Member Name Data Type ---------------------------------- b_flags int b_forw struct buf * b_back struct buf * av_forw struct buf * av_back struct buf * b_bcount int b_error short b_dev dev_t b_un.b_addr caddr_t b_lblkno daddr_t b_blkno daddr_t b_resid int b_iodone void (*b_iodone) () b_proc struct proc * ---------------------------------- MEMBERS
Specifies binary status flags. These flags indicate how a request is to be handled and the current status of the request. The following flags are applicable to kernel modules that are device drivers: B_READ, B_DONE, B_ERROR, B_BUSY, and B_PHYS. See the DESCRIPTION section for more information on these flags. Specifies a hash chain. Only the entity (driver, buffer cache) that owns the buf structure can use or reference this member. A driver receiving a buf structure from the buffer cache through the strategy routine must not use this member. Specifies a hash chain. Only the entity (driver, buffer cache) that owns the buf structure can use or reference this member. A driver receiving a buf structure from the buffer cache through the strategy routine must not use this member. Specifies the position on the free list if the b_flags member is not set to B_BUSY. Specifies the position on the free list if the b_flags member is not set to B_BUSY. Specifies the size of the requested transfer (in bytes). Specifies that an error occurred on this data transfer. This member is set to an error code if the b_flags member bit was set. Specifies the special device to which the transfer is directed. Specifies the address at which to pull or push the data. Specifies the logical block number. Specifies the block number on the partition of a disk or on the file system. Specifies (in bytes) the data not transferred because of some error. Specifies the routine called by iodone. The device driver calls iodone at the completion of an I/O operation. Specifies a pointer to the proc structure that represents the process performing the I/O. DESCRIPTION
The buf data structure describes arbitrary I/O, but is usually associated with block I/O and physio. A systemwide pool of buf data struc- tures exists for block I/O; however, many kernel modules that are device drivers also include locally defined buf data structures. Kernel modules can use the following flags with the b_flags member: This flag is set if the operation is read and cleared if the operation is write. This flag is cleared when a request is passed to a driver strategy routine. The writer must call iodone to mark a buffer as com- pleted. This flag specifies that an error occurred on this data transfer. Kernel modules set this flag if an error occurs. This flag indicates that the buffer is in use. This flag indicates that the associated data is in user address space. NOTES
The operating system does not define a B_CALL flag. The iodone routine checks the b_iodone member to determine if you specified a comple- tion routine. If so, iodone clears b_iodone and then calls the specified completion routine. If you want to reuse this buf data structure, you must reset the b_iodone member to a completion routine. In fact, it is good programming practice to reset all of the referenced members of a buf data structure that you plan to reuse. FILES
buf(9s)
All times are GMT -4. The time now is 12:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy