Search Results

Search found 38817 results on 1553 pages for 'inline function'.

Page 13/1553 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Interface function C#

    - by user181421
    Hello, I have a function which implement an interface. something like this: string IMyInterface.MyFunction() { do something; } This function is available outside of my class. All working perfect. Now I also need to call this function from another LOCAL non public function. like this: void Func2() { string s; s = MyFunction(); } The problem is I get this error: "the name MyFunction does not exist in the current context local" Any help will be appreciated. TY.

    Read the article

  • Returning char* in function

    - by Devel
    I have function: char *zap(char *ar) { char pie[100] = "INSERT INTO test (nazwa, liczba) VALUES ('nowy wpis', '"; char dru[] = "' )"; strcat(pie, ar); strcat(pie, dru); return pie; } and in main there is: printf("%s", zap( argv[1] ) ); When compiling I get the warning: test.c: In function ‘zap’: test.c:17: warning: function returns address of local variable How should I return char* propertly?

    Read the article

  • function prototype declarations

    - by sandy101
    I am practice the function in c and come across to the program .... #include<stdio.h> int main() { float a=15.5; char ch ='C'; printit(a,ch); return 0; } printit(a,ch) { printf("%f\n%c",a,ch); } I want to know that why the above program compile and not give the error as i understood so for is ... The function in c must be declared with the specific prototype (but this program does not contain the prototype) why the program give the output 'x'for the char variable ? can the function in c are capable of accepting the value without being declared about type in parameters like what has done in the function declaration ?

    Read the article

  • function with array variable

    - by mtokoly
    How do I pass an array through a function, for example: $data = array( 'color' => 'red', 'height' => 'tall' ); something($data); function something($data) { if ($data['color'] == 'red') { // do something } } how can I get the function to recognize $data[color] and $data[height]?

    Read the article

  • how to load a page and then run a jquery function

    - by Khawar
    on master page i put this code to load page in same master page and then run jqeury function i m trying this $(document).ready(function() { $("#mainContactLink").click(function() { $(body).open("about-us.aspx", self); $(" #abtContacts").fadeIn(1000).siblings("div").fadeOut(100); $(" #abtContacts").siblings(); }); }); its not working.. any idea ?

    Read the article

  • calling a function from another function in python

    - by user1040503
    I have written this function that takes to strings in order to see if they are anagrams: def anagram_check(str_x, str_y): x = string1.replace(" ","") y = string2.replace(" ","") lower1 = x.lower() lower2 = y.lower() sorted1 = sorted(lower1) sorted2 = sorted(lower2) if sorted1 == sorted2: return True else: return False this function works fine, the problem is that now I need to use this function in another function in order to find anagrams in a text file. I want to print a list of tuples with all the anagrams in it. this is what i have done so far def anagrams_finder(words_num): anagrams = [] f = open("words.txt") a = list(f) list1 = ([s.replace('\n', '') for s in a]) list2 = ([i.lower() for i in list1]) list3 = list2[0:words_num] #number of words from text that need to be checked. for i in list3: .... I tried using for loops, while loops, appand.... but nothing seems to work. how can I use the first function in order to help me with the second? Please help...

    Read the article

  • PHP getimagesize is not working when is called from a function in function.php (Wordpress)?

    - by janoChen
    PHP getimagesize is not working when is called from a function in function.php. function.php: add_action('wp_head', 'get_image_size'); function get_image_size() { global $width; // I thought this would solve the problem but it didn't global $height; // I thought this would solve the problem but it didn't list($width, $height, $type, $attr) = getimagesize($options['logo']); echo "Image width " .$width; echo "<BR>"; echo "Image height " .$height; echo "<BR>"; } $options['logo'] is returning http://localhost/wordpress/wp-content/uploads/2010/12/logo4.png so the image is being displayed. I also did var_dump to $width and $height but they didn't show up. Any suggestions?

    Read the article

  • how to callback a lua function from a c function

    - by pierr
    Hi, I have a c function test_callback accepting a point to a function as the parameter and It will "callback" that function. //typedef int(*data_callback_t)(int i); int test_callback(data_callback_t f) { f(3); } int datacallback(int a ) { printf("called back %d\n",a); return 0; } //example test_callback(datacallback); // print : called back 3 Now, I want to wrap test_callback so that they can be called from lua, suppose the name is lua_test_callback ;and also the input parameter to it would be a lua function. How should I achieve this goal? function lua_datacallback (a ) print "hey , this is callback in lua" ..a end lua_test_callback(lua_datacallback) //expect to get "hey this is callback in lua 3 "

    Read the article

  • What are function pointers good for ?

    - by gramm
    Hi, I have trouble seing the utility of the function pointers. I guess it may be useful in some case (it exists, after all), but I can't think of a case where it's better or unavoidable to use a function pointer. Could you give some example of good use of function pointers (in C or C++)? Many thanks :)

    Read the article

  • Python function correctly/incorrectly?

    - by Anthony Kernan
    I'm just starting too use python, learning experience. I know the basics logic of programming. I have a function in python that is running everytime, even when it's not supposed to. I use an if statement in the beginning of the function. I don't know why this if statement is not working, confused. I have another function that is similar and works correctly. Am I missing something simple? Here's the function that is not working... def check_artist_art(): if os.path.exists("/tmp/artistinfo") and open("/tmp/artistinfo").read() != title: #if artist == "": if os.path.exists(home + "/.artist"): os.remove(home + "/.artist") if os.path.exists("/tmp/artistinfo"): os.remove("/tmp/artistinfo") print artist return False else: os.path.exists("/tmp/artistinfo") and open("/tmp/artistinfo").read() == artist return False return True And this is the similar function that is working correctly.. def check_album(): if os.path.exists("/tmp/albuminfo") and open("/tmp/albuminfo").read() != album: if os.path.exists(home + "/.album"): os.remove(home + "/.album") if os.path.exists("/tmp/albuminfo"): os.remove("/tmp/albuminfo") return False elif os.path.exists("/tmp/trackinfo") and open("/tmp/trackinfo").read() == artist + album: return False return True Any help is greatly appreciated.

    Read the article

  • I need help understanding how this jQuery filter function works, line-by-line, if possible

    - by user717236
    Here is the HTML: <div> <h3>text</h3> </div> <div> <h3>moretext</h3> </div> <div> <h3>123</h3> </div>?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Here is the JS: var rv1_wlength = $("div").filter(function() { return $(this).find("h3").filter(function () { return $(this).text() != "123"; }).length; }); var rv1_wolength = $("div").filter(function() { return $(this).find("h3").filter(function () { return $(this).text() != "123"; }); }); var rv2 = $("div").find("h3").filter(function() { return $(this).text() != "123"; }); alert(rv1_wlength.text()); // text // moretext alert(rv1_wolength.text()); // text // moretext // 123 alert(rv2.text());? // textmoretext I don't understand why the first two methods print the elements on each line, whereas the second method concatenates them. "rv2" is a jQuery object. Then, what are the first two (rv1_wlength and rv1_wolength)? Furthermore, I don't understand why the inclusion of the length property makes all the difference in filtering the elements. The second method does nothing, since it returns all the elements. The first method, with the only change being the addition of the length property, correctly filters the elements. I would very much like a line-by-line explanation. I would sincerely appreciate any feedback. Thank you.

    Read the article

  • C++ inheritance and member function pointers

    - by smh
    In C++, can member function pointers be used to point to derived (or even base) class members? EDIT: Perhaps an example will help. Suppose we have a hierarchy of three classes X, Y, Z in order of inheritance. Y therefore has a base class X and a derived class Z. Now we can define a member function pointer p for class Y. This is written as: void (Y::*p)(); (For simplicity, I'll assume we're only interested in functions with the signature void f() ) This pointer p can now be used to point to member functions of class Y. This question (two questions, really) is then: Can p be used to point to a function in the derived class Z? Can p be used to point to a function in the base class X?

    Read the article

  • pointer to const member function typedef

    - by oldcig
    I know it's possible to separate to create a pointer to member function like this struct K { void func() {} }; typedef void FuncType(); typedef FuncType K::* MemFuncType; MemFuncType pF = &K::func; Is there similar way to construct a pointer to a const function? I've tried adding const in various places with no success. I've played around with gcc some and if you do template deduction on something like template <typename Sig, typename Klass> void deduce(Sig Klass::*); It will show Sig with as a function signature with const just tacked on the end. If to do this in code it will complain that you can't have qualifiers on a function type. Seems like it should be possible somehow because the deduction works.

    Read the article

  • Giving my function access to outside variable

    - by brett
    I have an array outside: $myArr = array(); I would like to give my function access to the array outside it so it can add values to it function someFuntion(){ $myVal = //some processing here to determine value of $myVal $myArr[] = $myVal; } How do I give the function the right scoping to the variable?

    Read the article

  • Passing a pointer to a function that doesn't match the requirements of the formal parameter

    - by Andreas Grech
    int valid (int x, int y) { return x + y; } int invalid (int x) { return x; } int func (int *f (int, int), int x, int y) { //f is a pointer to a function taking 2 ints and returning an int return f(x, y); } int main () { int val = func(valid, 1, 2), inval = func(invalid, 1, 2); // <- 'invalid' does not match the contract printf("Valid: %d\n", val); printf("Invalid: %d\n", inval); /* Output: * Valid: 3 * Invalid: 1 */ } At the line inval = func(invalid, 1, 2);, why am I not getting a compiler error? If func expects a pointer to a function taking 2 ints and I pass a pointer to a function that takes a single int, why isn't the compiler complaining? Also, since this is happening, what happens to the second parameter y in the invalid function?

    Read the article

  • removing dependancy of a private function inside a public function using Rhino Mocks

    - by L G
    Hi All, I am new to mocking, and have started with Rhino Mocks. My scenario is like this..in my class library i have a public function and inside it i have a private function call, which gets output from a service.I want to remove the private function dependency. public class Employee { public virtual string GetFullName(string firstName, string lastName) { string middleName = GetMiddleName(); return string.Format("{0} {2} {1}", firstName, lastName,middleName ); } private virtual string GetMiddleName() { // Some call to Service return "George"; } } This is not my real scenario though, i just wanted to know how to remove dependency of GetMiddleName() function and i need to return some default value while unit testing. Note : I won't be able to change the private function here..or include Interface..Keeping the functions as such, is there any way to mock this.Thank

    Read the article

  • How to catch unintentional function interpositioning?

    - by SiegeX
    Reading through my book Expert C Programming, I came across the chapter on function interpositioning and how it can lead to some serious hard to find bugs if done unintentionally. The example given in the book is the following: my_source.c mktemp() { ... } main() { mktemp(); getwd(); } libc mktemp(){ ... } getwd(){ ...; mktemp(); ... } According to the book, what happens in main() is that mktemp() (a standard C library function) is interposed by the implementation in my_source.c. Although having main() call my implementation of mktemp() is intended behavior, having getwd() (another C library function) also call my implementation of mktemp() is not. Apparently, this example was a real life bug that existed in SunOS 4.0.3's version of lpr. The book goes on to explain the fix was to add the keyword static to the definition of mktemp() in my_source.c; although changing the name altogether should have fixed this problem as well. This chapter leaves me with some unresolved questions that I hope you guys could answer: Does GCC have a way to warn about function interposition? We certainly don't ever intend on this happening and I'd like to know about it if it does. Should our software group adopt the practice of putting the keyword static in front of all functions that we don't want to be exposed? Can interposition happen with functions introduced by static libraries? Thanks for the help. EDIT I should note that my question is not just aimed at interposing over standard C library functions, but also functions contained in other libraries, perhaps 3rd party, perhaps ones created in-house. Essentially, I want to catch any instance of interpositioning regardless of where the interposed function resides.

    Read the article

  • Function name inside a variable

    - by John Doe
    Hello. I have a simple question (i guess). I'm getting the name of the function inside a variable from database. After that, i want to run the specific function. How can i echo the function's name inside the php file? The code is something like this: $variable= get_specific_option; //execute function $variable_somesuffix(); The "somesuffix" will be a simple text. I tried all the things i had in mind but nothing worked.

    Read the article

  • Pass variable name to a function in r

    - by Misha
    Is it possible to pass just a variable name in a function call and have it utilised as such within the function?? pseudocode: q<-function(A){ b<-(w%in%A.2|w%in%A.7) factor(b,levels=c(F,T),labels=c("non-"A,A))} w<-c(0:10) e.2<-c(1,2) e.7<-c(6,7) what I´d like to do is q(e) and have returned non-e,e,e,non-e,non-e,e,e,non-e,non-e //M q<-function(A) { a2<-get(paste(a,".2",sep="")) a7<-get(paste(a,".7",sep="")) b<-(w%in%a2|%in%a7) factor(b,levels=c(F,T),labels=c(paste("non-",a,sep=""),a)) } q("e") Thx, M

    Read the article

  • calling function in radiobutton group

    - by vijisai
    thank you very much. with your help, i am now able to call the function for each radio button. however, i get a error message Reference to non-existent field 'ics_si' ics_si is my function, which has the following code, i do not know where i am making a mistake i have created the edit box for user to input the values for bore and stroke. and vdisp is calculated and the result is displayed in the third edit box. function ics_si_Callback(hObject, eventdata, handles) b = str2double(get(handles.bore,'String')); s = str2double(get(handles.stroke,'String')); vdisp = (pi * b * b * s*10^(-3))/4; set(handles.vdisp,'String',vdisp); this code must be called when i press the first or second radio button. i.e. when the radio button is pressed, it should call the function ics_si, calculate it and display the result. how to get this.

    Read the article

  • How to pass function reference into arguments

    - by Ockonal
    Hi, I'm using boost::function for making function-references: typedef boost::function<void (SomeClass &handle)> Ref; someFunc(Ref &pointer) {/*...*/} void Foo(SomeClass &handle) {/*...*/} What is the best way to pass Foo into the someFunc? I tried something like: someFunc(Ref(Foo));

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >