Thread: Calculator on C#

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    19

    Calculator on C#

    Hey!
    I have a calculator with buttons, and when I click the numbers or operators, it goes to a string array. So;

    Press 3
    Press +
    Press 2
    Press =

    and my array is str[0]='3' str[1]=.... so on...

    And also I have a C code which calculates the string you entered with some algorhytms and gives a double value as a result. So the question is;

    How can I send my STR array in C# to my C program? I mean I want to use my C program as a source code. and How to return that double value to my C# program?

    For now, I don't want to change my C codes into C# codes. I want it to keep as is. Just use it as a source code. Is that possible?

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    You use P/Invoke ( Platform Invoke Tutorial (C#) ) to communicate with unmanaged libraries from C#. I have to say though, using P/Invoke to perform such a very simple task as calculating a character array of digits and operators seems bizarre.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    I think he's talking about spawning the C program and sending it the string as command line parameters. is this correct?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calculator
    By ianphil397 in forum C Programming
    Replies: 6
    Last Post: 11-24-2008, 12:04 PM
  2. need help with calculator
    By mthemapc in forum C++ Programming
    Replies: 4
    Last Post: 02-19-2008, 04:14 PM
  3. calculator
    By MOH123 in forum C++ Programming
    Replies: 9
    Last Post: 09-14-2005, 07:06 PM
  4. Calculator Help!
    By jdude in forum C Programming
    Replies: 4
    Last Post: 10-01-2004, 11:48 AM
  5. Calculator
    By TonyP in forum C++ Programming
    Replies: 6
    Last Post: 04-14-2003, 10:14 PM