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];
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 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.
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.
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.
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.
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:
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.
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());
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;
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
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?
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);
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.
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.
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;
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.
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?
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.
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; }
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: { 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.
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.