Programming :: C++ Passing Pointer Variable As A Reference Parameter

Jan 21, 2011

Say, i have an imaginary std library function, which I want to call.

Code:
void std_lib_func(ObjectType *param);

Now in my c++ program, I have a main() function, and I will like to call a customized function (which will in turn call the std lib function) from the main function, as below:

Code:
int main()
{
ObjectType *aobj;
customized_func(aobj);
}
[Code]...

I tried the below but get an error that the std lib function is expecting a ObjectType* param, not aobj. How should I work this out.

Code:
void customized_func(ObjectType aobj)

View 4 Replies


ADVERTISEMENT

Programming :: Parameter Passing In The HTML?

Jun 11, 2010

If I have the following links in HTML

Code:

<a href=lang.php?lang=cymraeg>Cymraeg</a>
<a href=lang.php?lang=english>English</a>

and lang.php has a link to page2.html, how do I pass on the value of the lang parameter from lang.php to page2.html? The value needed is the one passed in to lang.php.

View 3 Replies View Related

Programming :: Pass By Reference A Parameter Without Assigning A New Object?

Dec 28, 2010

How can I pass by reference, a parameter, without assigning a new object? In my first example, var = "changed" creates a new local object. In the second, mylist.append will affect the reference target. How to i achieve the same effect with example 1?

Code:
#!/bin/python
var = "unchanged"
def print_string( var ):

[Code].....

View 2 Replies View Related

Programming :: Passing A Char* By Reference In C++?

Apr 26, 2010

Below I've presented the declaration, definition and the calling method of a function w.r.t pass by reference:

Declaration

Code:

void getUnpackedMsg (unsigned char &data, unsigned int numberOfBits);
Definition
line 278: Shown in RED

Code:

void packedMessage :: getUnpackedMsg (unsigned char &emptyArray, unsigned int numberOfBits)
{
...
...
printf ("

[code].....

View 3 Replies View Related

Programming :: Passing Variables By Reference?

Mar 19, 2010

I was trying to make a code for passing variables by reference..here's the code:

#include<iostream>
using namespace std;
void fun(int& ,int& );
int main(){

[Code].....

invalid initialization of non-const reference of type 'int&' from a temporary of type 'int*'

View 9 Replies View Related

Programming :: Find And Replace Using Passing A Parameter To Said Command?

Apr 9, 2010

I am trying following script can I do this or is there a way to do find and replace the replacing word is dynamic input by user

echo -n "Enter name:"
read RP_USER
sed 's/text1/$RP_USER/' /home/user/file1 > /home/user/file2

View 5 Replies View Related

Programming :: Parameter Passing: Parameters In General Info Requested

Apr 26, 2010

Ive read a few books and a lot of tutorials on C but can't find this topic explained in a deliberate way.I can find bits and pieces but nothing thorough.

View 9 Replies View Related

Programming :: Bash - Passing Variable To Ssh?

May 8, 2010

I have a file with around 1000 IP addresses in it and I need to be able to ssh into each one of them, run a single command, and then exit. I already know the ssh command I want to run and it looks like this:

Code:

shpass -p [password] ssh -p 10022 -o StrictHostKeyChecking=no root@[ip variable] 'reboot'

(I know shpass is not good to use and keys are the correct way but I don't have any other options in this scenario.) if these ip addresses were in a .csv file, by themselves with no other information, how would I create a script to do the above command to each ip until the end of the file?

View 8 Replies View Related

Programming :: Passing A Variable To Bc In Bash ?

Jan 14, 2009

I cannot for the life of me get this little (simple) script I wrote to work. Here is the entire script:

Code:

#!/bin/bash
ASPECT=`mediainfo $1 |grep "Display aspect ratio" |cut -d : -f 2`
HEIGHT=`echo "320 / $ASPECT" |bc`
SIZE=`echo 320x$HEIGHT`

[code]......

An input filename ($1) is fed into mediainfo, which by the use of grep and cut spits out a single number which is the aspect ratio. This is then divided by bc into 320, which gives the desired height dimension for the file that I want ffmpeg to create for me. Finally, ffmpeg runs using the calculated dimensions... Basically, it's the passing of the $ASPECT variable to bc that seems to fail. It looks like bc won't read the output from the mediainfo line... It always crashes out with:

Code:

(standard_in) 1: illegal character: ^M I've tried doing something even simpler like this to debug by just trying it to display the calculation on the screen:

Code:

#!/bin/bash
ASPECT=`mediainfo $1 |grep "Display aspect ratio" |cut -d : -f 2`
HEIGHT=`echo "320 / $ASPECT" |bc`
echo $HEIGHT

and it does the same, so it's definitely bc that won't accept the output from mediainfo.

View 4 Replies View Related

Debian Programming :: Passing Variable Between Invocations

Jan 9, 2014

I want to build on the code from /etc/apt/apt.conf.d/05etckeeper to work with Snapper, the new-in btrfs (et al) snapshot package.

Code: Select allDPkg::Pre-Invoke       { "if [ -x /usr/bin/etckeeper ]; then etckeeper pre-install; fi"; };
DPkg::Post-Invoke      { "if [ -x /usr/bin/etckeeper ]; then etckeeper post-install; fi"; };

The etckeeper code will work well as a template, but I need to pass a parameter between the pre- and post- instances. The parameter is obtained from the pre- invocation and passed to the post- invocation.I know that something similar to my quest is done with the 'pid' but how to do it in the 'standard' way. Happily there can't be multiple dpkg instances running concurrently (prevented by dpkg?) so I don't have to worry about that issue.

Q1. What is the 'standard' way of passing parameters about?

Code: Select allsnapper -c etc create -t pre  -p     (which 'prints' the parameter (int) to pass to the following invocation)
snapper -c etc create -t post --pre-number  <parameter>  in place of the two etckeeper calls.

Q2. How do I pick up the 'printed' output of the 'pre' call? I think it's just a 'get' from the stream but perhaps I've missed something.?

View 2 Replies View Related

Programming :: Passing Local Variable Pointers In ASM

Apr 12, 2010

I want to know is there some more efficient way of passing a pointer to a local variable as a parameter to a function in x86 asm? Right now I have to move the base pointer to a temp register, subtract from the register and pass that, like this (assuming a local var at esp-4):

Code:
mov eax, ebp
sub eax, 4
push eax
Is there a better way?

View 8 Replies View Related

Programming :: Passing Variable To Oracle Query With PHP

Jul 11, 2011

I'm having some trouble this morning to send a SQL query to our Oracle DB server in PHP. When I try to pass my value "OF/110246801A01" as variable it tell's me "Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number"

PHP Code:
$ociO ='OF/110246801A01';
$selectAllFieldsFromOf=oci_parse($conn,"SELECT*FROMMFGOPEWHEREMFGNUM_0LIKE':ociOf' ");
oci_bind_by_name($selectAllFieldsFromOf,":ociOf",$ociOf,15);
$resultQuery =oci_execute($selectAllFieldsFromOf);
if(!$resultQuery){
$e = oci_error($selectAllFieldsFromOf);
return trigger_error(htmlentities($e['message'],ENT_QUOTES),E_USER_ERROR);
[Code]....

View 1 Replies View Related

Programming :: Passing Perl Variable Into Input Tag In Cgi Script?

Aug 27, 2010

How can I to pass a perl variable into html input tag? For example, If a have got a cgi script:

Quote:

use CGI;
use DBI;
my $owner = $cgi->param('owner');

[code]....

How can I to pass $owner variable?

View 1 Replies View Related

Programming :: BASH Conditionals - Passing Condition As Variable ?

Sep 17, 2009

I'm trying to implement an assert function similar to:[url]

However, I'm having trouble with file existence testing when the file name has a space in it.

I have distilled the problem down to the following:

This code works as expected, printing 'yes' if '~/test file' exists, and no if not.

Code:

However, this code gives an error.

Code:

The error:

Code:

Which tells me that it is splitting ["~/test file"] into ["~/test] and [file"]. Why? Is there a way around this?

Note that if you simply use a file path without a space, both cases work perfectly. Is this a BASH bug possibly? I just can't understand why the first would work, but the second wouldn't.

View 8 Replies View Related

Programming :: Passing A Variable At Compile Time - Send POSITION

Jan 14, 2010

I want pass a variable at compile time.

for example in x.c
int global_var = POSITION;

How can I send this POSITION at compile time. ie like # make POSITION=10 Is it possible?

View 5 Replies View Related

Programming :: Vfprintf In 64-bit Environment - Warning: Passing Argument 3 Of Vfprintf From Incompatible Pointer Type

Apr 14, 2010

I want to use vfprintf with the char * on 64-bit. Here is the sample code:

[Code]...

In this code, I am getting warning: passing argument 3 of vfprintf from incompatible pointer type I have done sizeof(va_list) on 64-bit, and its 24 bytes. I don't know how am I suppose to use the va_list this way.

View 1 Replies View Related

Programming :: Warning: Pointer Targets In Passing Argument 1 Of "STRING_stricmp" Differ In Signedness

Jul 13, 2011

i have this warning "differ in signedness".

[Code]...

so i was getting this error. im thinking it may be because of somewhere i declared unsigned and signed so this signedness warning occurring.

Code:

switcase.c: In function ImplementDebugCmd: switcase.c:385: warning: pointer targets in passing argument 1 of STRING_stricmp differ in signedness

View 1 Replies View Related

Server :: Shell Scripting Command Line / Getting Error While Passing Parameter?

May 6, 2011

I am very new to shell scripting.How does one pass a command-line parameter to a shell script?for the below program
#/bin/bash
mount -t cifs -o user=ramkannan,password=Linux123@ //10.200.1.125/ramkannan /MT
cd /MT/test
date=`/bin/date "+\%Y-\%m-\%d-\%H-\%M-\%S"`
mysqldump -uroot -pram2@ employeedb > $date.sql
gzip $date.sql

I want to pass parameter for everything,i tried in google and did but iam getting error while passing parameter to all

#/bin/bash
mount -t cifs -o user=$1,password=$2 //10.200.1.125/ramkannan /MT
cd /MT/test
date=`/bin/date "+\%Y-\%m-\%d-\%H-\%M-\%S"`
mysqldump -uroot -pram2@ employeedb > $date.sql
gzip $date.sql

i was getting error while passing parameter to all.

View 2 Replies View Related

Programming :: SH: Passing A Variable Out Of A "while - Do - Done" Loop

Jul 3, 2011

"While ; do ; done" is very convenient for SH coding. However sometimes you may be annoyed by your computed variable within the "while do done" type loop. What to do how to pass it out of the loop to the outside of the bash code? A solution is to write it into the /tmp or on the disk... and to call it back after. - not elegant... really not... Anyone would know a trick another alternative that would look nicer?

Code:
# Count file total size
TOTAL_SIZE=0
LISTOFFILES=`cat "$HOME/.fvwmoscfg/fvwmburnerlist.lst"`
echo "$LISTOFFILES" | while read i ; do
SIZE=`du -bs $i | cut -f 1`
TOTAL_SIZE=`expr $SIZE + $TOTAL_SIZE`
echo "$TOTAL_SIZE" > "$HOME/.fvwmoscfg/fvwmburnerlisttotalsize.lst"
done
TOTAL_SIZE=`cat $HOME/.fvwmoscfg/fvwmburnerlisttotalsize.lst`

echo "The total size of all files and folders is : $TOTAL_SIZE"

View 8 Replies View Related

Ubuntu :: Shell: Dirname With Variable As Parameter?

Jul 31, 2010

Code:
a=/this/is/a/dir.txt
dirname $a

[code]....

View 2 Replies View Related

General :: Bash Variable As Parameter To Script?

May 10, 2011

I want to create a variable that when passed as a parameter to another bash script will keep its string quotes (so it stays as one parameter). What ways can I achieve this cleanly?

Code:

john@ubuntu:/usr/local/src$ cat foo.sh
#!/bin/bash
echo $0

[code]....

View 8 Replies View Related

General :: Passing One Variable To Another

Jan 8, 2011

I am new to bash scripting. I want to know whether i can pass one variable to another. For example $1 represent argument1. Now if i want to get the argument 1 like USER="1" now i want $ of $USER to execute $1 so what should i do..

View 2 Replies View Related

Fedora :: Gcc Error: Conflicting Types - Warning: Passing Argument 2 Of R00002_ From Incompatible Pointer Type

Jun 17, 2011

I'm trying to install a program (MOPAC2007) from the source code which is a 32-bit program, but I get the following errors:

[code]...

I have installed the 32-bit libraries (gcc-gfortran.i686, glib.i686, libstdc++.i686).

View 1 Replies View Related

Red Hat / Fedora :: Passing Xml In Mem Or Variable To Xmllint?

Jul 24, 2010

How can I pass xml data from memory or a variable to xmllint that expects a file as input? Or does xmllint have the capabilities to read from stin or a variable?

View 4 Replies View Related

General :: Bash: Substitute Parameter In A Quoted String - Stored In Another Variable

Jan 31, 2010

(variable substitution?)
(parameter expansion?)
Code:
run_repeatedly()
{
NUM=0
while [ <irrelevant stuff here> ]
[Code]....

run_repeatedly "programX -o "./messy/path/output-$NUM.txt"" The echo inside the loop prints "...-$NUM.txt"; obviously I'm aiming to have bash substitute the iteration number so that I end up with many output files not 1.

View 5 Replies View Related

Fedora Servers :: When Passing Variable From One Page To The Next It Gets Lost

Jun 19, 2010

I have installed FC13 on my laptop and set it up as a development server. Here is my issue when passing variable from one page to the next it gets lost. My PHP includes work DB connect string works from the include.

View 1 Replies View Related

Programming :: Pointer To Pointer Segmentation Fault?

Jun 27, 2009

I have been googling trying to fix this ... basicly I have a (int **) variable, and when I try to pass a (int) value to a specific position, I have seg.fault.Resuming what I have is:

int ** p;
p[0][0] = 1; //segmentation fault

View 7 Replies View Related

Programming :: Bash - Read Content Of File To Variable And Use This Variable In For Loop ?

Aug 21, 2009

I'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.

For example:

Code:

Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).

View 6 Replies View Related

Programming :: Make A New Variable With The String From The Old Variable Btut Without Any Plus Sign?

Apr 7, 2010

my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.

i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't

foo=+12.40
bar=${foo#+}

View 4 Replies View Related

Debian :: Passing A Variable To "find" Command?

Mar 9, 2011

I am trying to make a simple alias for find command that acceps a variable.

alias myfind="find $@ -type d -exec chmod 777 -fv {} ;"

this alias tells me that "find:paths must precede expression"

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved