C :: Compare Integers With Hard Coded Values Goes Wrong In DLL

Mar 6, 2015

I am about to transfer a project I have written in Applescript and Objective C to Excel/VBA/dll. I have started with the Objective C functions that I want to place in a dll and call via VBA.

The Objective C is C with a thin dusting of special Obejctive C code to have it talk with Applescript and the rest of the project so in theory it should be easy to make dlls written in C from it.

But I have already problems with the tiniest of all functions. I am sure it can be done more effectively but right now I need to know WHY it doesn't work if I am ever going to be able to transfer the much larger functions from Objective C to C.

Here is my original Objective C code:

Code: -

(NSNumber *)game:(NSNumber *)games gamechange:(NSNumber *)gameskifte
{
int gamesab = [games intValue];
int gameskifteab = [gameskifte intValue];

[Code].....

View 5 Replies


ADVERTISEMENT

C/C++ :: Two Hard-coded Arrays Into One 2-Dimensional Vector

Mar 20, 2012

Two Hard-coded Arrays into One 2-Dimensional Vector I have 2 arrays, each of them are hard-coded with integer values. I also have one 2-Dimensional vector and I want to put 1 array into the first column of the vector and the other array into the 2nd column of the vector. The reason is that I want to do math on the 2nd column of the vector only.

I am able to accomplish this with 3 arrays. Two of them are 1-Dimensional and the third array is 2-Dimensional.

I know how to pass ONE Array into ONE vector:

Code:
vector<int> myVector(typeArray, typeArray + 4);

however, when I declare a 2-Dimensional vector:

Code:
vector< vector <int> > myVector(3, vector<int> (2,0))

I am not seeing how to add TWO arrays or how to OUTPUT it to the screen.

Here is my code using DevCPP:

#include <iostream>    
#include <vector>
#include <Windows.h>

[Code]...

I don't get any errors, however, I don't know how to output it to the screen to see what it looks like.

View 5 Replies View Related

C++ :: User Can Read Or Write Into A File That Is Not Hard Coded

Jan 16, 2014

int main (){
string filename;
cout << "Enter the file name: ";
cin >> filename;
ofstream myfile( filename.c_str(), ios::app);
}

Here is the code and my original question was how do I make it so that the user can read or write into a file that is not hard coded.

hard code example:

string filename;
cout << "Enter the file name: ";
cin >> filename;
ofstream myfile( "file.txt", ios::app);

View 13 Replies View Related

C# :: Making String Equal Many Different Values Then Compare Those Values

Dec 18, 2014

I was wondering if this was even possible and if so, how do I do it.

else if (speech.ToLower().Contains("truck") && speech.EndsWith(number))
{
Here I would like to see if my speech had ended with any of the values i would have stored in the string "numbers". If it did, I would like to just take the value and add it to a new string called whatever
}

I have tried this a million different ways and I cant get it to work. I'm not even sure how I would go about storing tons of different numbers in one string, or if that's even possible.

View 10 Replies View Related

C :: Sensor Values Reading Wrong

May 24, 2014

My whole code is working but when the results are sent to my phone only the temperature value is reading correct the light value is all jungled up and moisture and pressure values are reading as 0.

Code:

#include "taskFlyport.h"
#include "grovelib.h"
#include "barometer.h"
#include <string.h>
extern BOOL incomingSMS;
extern int incomingIndexSMS;
extern BYTE incomingMemSMS;

[Code]...

View 4 Replies View Related

C++ :: Sensor Values Reading Wrong

May 26, 2014

I am only receiving the correct temperature value. The other 3 values are reading wrong. My format string isent matching the variable list. What I need to do.

float data_bar = 0.0;
float data = 0.0;
float anVal = 0.0;
float moistureVal = 0.0;
while(1) {

// Get the new value using the get() function

[Code] ....

View 3 Replies View Related

C/C++ :: Array Switches Wrong Values

Jun 7, 2014

I have a game that requires the switching of tiles. When I try to switch the blank tile (_) with 5, the 5 switches with the 8 instead of the tile switching with the blank tile. The code behaves the same with top row. I have observed that this only happen in the row and column bound by [0][0]; For example the four top left tiles ([8, 7, 5, are 4]) are behave erratically.

Here is sample code!

//swap if columns are equal and blank is to bottom
else if ((blankCol==tileCol) && (blankRow-tileRow==1)) {
temp = board[blankRow][blankCol];
board[blankRow][blankCol] = board[tileRow][tileCol];
board[tileRow][tileCol] = temp;
return true;
}

I am thinking perhaps there may be a double switch but then again why does it for only the left column and top row.

Attached image(s)

View 2 Replies View Related

C/C++ :: Compare Values Stored In First Array To User Inputted Values In Second Array

Oct 19, 2014

Goal: Write a program that compares the values stored in the first array to the user inputted values in the second array.

In order to fix this error: [URL]...

I had to change my array initialization to one with a star in front of it:

char a1[]={"a","d","b","b","c","b","a","b","c","d","a","c","d","b","d","c","c","a","d","b"};
to:
char *a1[]={"a","d","b","b","c","b","a","b","c","d","a","c","d","b","d","c","c","a","d","b"};

I also changed my 2nd array to one with a star in front of it: char *a2[20];

What does this mean exactly? Putting a star in front of an array?

Also, I am now getting an "unhandled exception" when I try to get input for my 2nd array:

cin>>a2[i];

View 3 Replies View Related

C++ :: How To Compare Two Double Values

Mar 24, 2014

I want to compare two double values

double x = 3072.00000000;
double y = 3072.0000000;

when checking with if its not working

if(x==y) it not working

View 1 Replies View Related

C++ :: How To Compare Values Of Two Objects Of Same Class

May 27, 2013

Running into a snag in my program. I can't seem to figure out how to have an object of a class be able to look at all the other objects of its own class.

Reasoning being, I'm working on a game with multiple ships flying around in the same space. Each ship is a class.
Each ship has an x and a y, and needs to compare the angle and distance of other ships' x and y coordinates to see if they're visible on the same screen.

How to tell an object to look at objects of its own class.

Here's some code:

common.h

#ifndef COMMON_H_INCLUDED
#define COMMON_H_INCLUDED
int dist(int x1, int y1, int x2, int y2);
int get_info(int which);

[Code] ....

Basically, I just don't know how to properly write a function, call, or how to get the info I need, to the Player::get_closest() function so that it can see the other play objects.

View 7 Replies View Related

C# :: Compare Values From User Input

Nov 3, 2014

What do I put to have UserNumber == 1-10? In other words I want it to say...

if UserNumber equals 1 through 10 <<<<This is where I'm having the issue.

Do this
Else
Do this

namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Start:
Console.WriteLine("Please enter a number between 1 and 10");
int UserNumber = int.Parse(Console.ReadLine());

[Code]...

I got it.

View 8 Replies View Related

C/C++ :: Traversing A List Comparing To Compare Values?

Apr 22, 2014

I have a method that traverses a list to compare a number from the list to user input from elsewhere in the program. I have tried a few different things and I am probably overlooking something simple but my problem is my if statement is executing the else statement every run no matter if the input matches. This function is to return the location in the list that the num matches. -1 if no match, 0, 1, 2, otherwise depending on the number of nodes.

int NumberList::find(int num)
{
int temp = 0, count = 0;
ListNode *nodePtr;

[Code]....

View 2 Replies View Related

C/C++ :: Parsing Integers Values From Strings

Sep 30, 2014

So I have this assignment to read a file in, malloc some arrays, run it through a perceptron and to display the final weights. I have the majority of it already written but this is only my third program in C and I'm more familiar with Java and Python than C.

The problem I'm having is when I read in command line arguments, I can't seem to parse integer values from the strings in argv[i] by using atoi().

I've included the piece of code where I'm trying to 'parse.' I understand atoi convers ascii to integer, but I don't understand if it just gives you the ascii code or the number that it actually represents. I attempt to use atoi on lines 33-35

The input arguments in the command line are:

bob in.csv 100 5 10

int main(int args, char* argv[]){
int ** ra; // array of array of pointers
FILE *ifp; // file pointer
char cc; // char var for reading input from file
int i = 0; // counter

[Code] ....

View 3 Replies View Related

Visual C++ :: Passing As Parameters To A Function Characters Coded In UTF 8

Apr 9, 2014

I'm using the Visual C++ Express 2008 and i need to pass as parameters to a function characters coded in UTF 8. My environment is Windows 7. The editor of the VC++ write in UTF 8 or UTF 16? If it writes in UTF 16 how can i change it?

View 2 Replies View Related

C :: Program To Get Series Of Integers From A User And Storing Those Values Into Array

Feb 10, 2013

The problem deals with writing a program to geta series of integers from a user and storing those values into an array. Then use a function called selection_sort, when given an array with n elements, the function must sort the array from smallest to largest values.

I have code, and im trying to get it to compile but im getting these implicit declaration errors and conflicting types. Here is my code and the compiler errors.

Code:
Compilation started at Sun Feb 10 20:14:48

gcc -Wall -o ex9-1 ex9-1.c
ex9-1.c: In function 'main':
ex9-1.c:16:5: warning: implicit declaration of function 'selection_sort' [-Wimplicit-function-declaration]
ex9-1.c:20:2: warning: implicit declaration of function 'prinf' [-Wimplicit-function-declaration]
ex9-1.c: At top level:

[Code] ...

Compilation exited abnormally with code 1 at Sun Feb 10 20:14:49

Code:
#include <stdio.h>
int main(void) {
int a[100], i, j, N;
printf("How many numbers will you be entering: ");
scanf("%d", &N);

[Code] .....

View 4 Replies View Related

C :: How To Get Memory Address Of A File In Hard Disk

Sep 12, 2013

I made a text file. I can do all File I/O functions in c. no problem! except that "I want to get the memory address of the beginning of that File", so that I can access each character of the file by incrementing memory address.

View 1 Replies View Related

C :: How To Access Sata Hard Drive At Sector Level

Mar 7, 2013

I want to access sata hard drive(eg. D drive) at sector level using C programming.I want to read the values stored in the memory locations.

View 3 Replies View Related

Visual C++ :: Capturing Both Soft / Hard Keyboard Inputs?

Oct 4, 2013

I have a C++ WIN32 DLL that acts as a server for a UI. Now i want to capture all keyboard inputs in the PC on the WIN32 dll, whenever the UI has active focus. If the user is typing something into another app, i don't care.

The trick is that, the keyboard can be both a software keyboard or a hardware keyboard. I want to be able to capture every keyboard input from the user on the PC in which the UI and DLL is running.

Is this possible to do? How can i implement this?

View 1 Replies View Related

C++ :: Create A Program That Is Able To Save Database Of Items To File On Hard Drive

Mar 18, 2013

Write a program that is able to save a list of items such as books, CDs, or DVDs and the items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.I would like to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.I have this for a start of how to set up a storing program.

#include <iostream>
#include <iomanip>
using namespace std;
int main () {
const int arraySize = 10;
int a[arraySize] = { 2, 6, 4, 10, 12, 89, 68, 45, 37 };
int i, hold;

[code]....

View 2 Replies View Related

Visual C++ :: Open Large Files - Save Video As Long As Users Have Space In Hard Disk

Jan 15, 2013

Opening large files in c++. In my application, i am trying to save video as long as users have space in harddisk. What I am trying to do is when user is recording video i am trying to append the video data in to the file. The problem is that every time file size reach over 2GB my software crashes.

View 5 Replies View Related

C++ :: Read Set Of Integers Then Find And Print Sum Of Even And Odd Integers

Apr 21, 2014

I'm a beginner at c++ and I need to write a program that reads a set of integers and then finds and prints the sum of the even and odd integers. The program cannot tell the user how many integers to enter. I need to have separate totals for the even and odd numbers. what would I need to use so that I can read whatever number of values the user inputs and get the sum of even and odd?

View 2 Replies View Related

C++ :: Variable Assigned Wrong Value?

Nov 15, 2012

Consider the following:

Code:
float foo( float const *bar )
)
{
float temp;
temp = *bar;
...
}

Something I am noticing is that temp right after the assignment to *bar, is not the same value as *bar. This is for a project at work and the code runs on an embedded board with an ARM processor. I've copied the function into a standalone program for both Visual Studio and Code::Blocks and it works correctly there.

View 12 Replies View Related

C++ :: Fees Showing Up Wrong On Program

Feb 19, 2014

I'm writing a program that shows check fees for different amounts of checks. My other fees are showing up right but the .10 cents is not. It's showing up as .08 cents per check when I run the program.

Oh yeah the + 10 is for a $10 fee

Code:
else if (checks < 20 || checks >= 0) {
fee = .10 * checks + 10;
cout<< "Bank service charge for the month is $ " << setprecision(4) << endl;
}

View 3 Replies View Related

C :: Guess 4 Int Array With How Many Are In Right And Wrong Positions

Feb 11, 2013

For an assignment I have to create a random array of four integers, and then I have to allow someone to input up to ten guesses to guess the array in the correct order. I also need to be able to display whatever was generated by inputting -1. Finally, after every guess I have to tell the inputter how many of the guessed integers are correct and in the correct position, as well as how many integers are correct but not in the correct position.

So far I've been able to get the random array to generate properly, but inputting negative one has no effect, although if I input it four times in a row I get to my 'lose' condition. Also, it only seems to allow the user to input 4 guesses and not 10 before going straight to the 'lose' condition. I need to get these issues sorted out before I can move on to showing how many guesses are right etc....

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time (NULL));

[Code] ....

View 3 Replies View Related

C# :: Des Encryption Produces Wrong Output

Feb 14, 2012

I have the following function:

Code:
public static void Des(byte[] key, byte[] inBuf, byte[] outBuf) {
if (key.Length != 8 || inBuf.Length != 8 || outBuf.Length != 8) {
throw new Exception("Des: Buffer or key length incorrect.");
}

DESCryptoServiceProvider des = new DESCryptoServiceProvider();

[Code] ....

I do not get the expected output of

Code: { 0x88, 0xBF, 0x0D, 0xB6, 0xD7, 0x0D, 0xEE, 0x56 }

instead I get

Code: { 0xC6, 0x61, 0x8D, 0x63, 0x0B, 0x39, 0x31, 0xB0 } am I doing something wrong?

I've even tried reversing the byte order of the test data, and I don't get the right result. I've tested the same data using C++ with CryptoPP on Linux, and I get the expected result, but I'm porting this code to run on .Net, and this is my main stoppage in the process at the moment.

View 5 Replies View Related

C++ ::  SendInput - Cursor Position Wrong

May 12, 2013

I recently wanted to create a (yet) simple program that simulates a mouse movement.So far I managed to make the program work. It does move the mouse, click when expected but the problem is the location it does click at.Here's my code:

#include <Windows.h>
#include <stdio.h>
int leftclick (DWORD x, DWORD y);
int main(){

[code]......

The problem now is: I want the program (for testing purposes) to click at (1920, 1080) and (100, 100) afterwards. Now it does click within a specific range. When I use GetCursorPos to retreive the cursors position it differs quite a bit from where I expected the click to be.

a second question I have is: When I declare the following flag (in the code above) the program does use relative coordinates even though it shouldn't.

input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP;

Where as it works out well when I add a MOUSEEVENTF_MOVE to it.I couldn't find any solution to this in Microsoft MSDN or any other website.

View 2 Replies View Related







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