C++ :: Retrieve A Pointer From Stack?
Aug 28, 2013In c89/90 is there a way to retrieve a pointer from stack or whatever that would behave as this would once cast to the correct type? This is more of a curiosity than a requirement.
View 6 RepliesIn c89/90 is there a way to retrieve a pointer from stack or whatever that would behave as this would once cast to the correct type? This is more of a curiosity than a requirement.
View 6 Repliesi wrote a program using pointers in a basic stack program below is the pop and push functions and their calls in main. basically getting random numbers and converting to char characters and inserting them into an int array.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
[Code]....
i have saved my data in sql and i can retrieve them except datetime i can't retrieve ,, this is my code
SqlCommand cmd1 = new SqlCommand("select ID,name,carplatnumber,cartype,expiredate,badgtype from [ID-personal] where id like('" + textBox1.Text + "%')", cn);
SqlDataReader dr1;
[Code].....
I am looking to retrieve data from a USB device, this device is a fingerprint scanner. Because I bought it online and wasn't reading carefully enough, drivers and other installation programs weren't included. Send it back? Nah . . .
I want to see if it is possible to retrieve data from this device. To be honest, I don't even know if it's possible, but I would love to give it a whack.
I looked into making INF files and things Microsoft has put out, but I honestly don't know where to start simply because I have absolutely no experience doing this. I have a program set up to organize the data and such, I just need to find a way to actually get it.
What should I research and look into? Are drivers necessary?
Here is a little more information :-)
I want to save data from a fingerprint scanner.I bought a fingerprint scanner, but nothing came with it (drivers, software, etc.). I decided to not return it and see what fun I could have.
I have no code written up yet (mainly because I don't know where to start). But I looked into the device a little...Microsoft recognizes it as a "Fingerprint Scanner" but is still considered unrecognized.I have the USB identifier (at work right now, don't have it on hand)...
Is it even possible to communicate with the device without the initial drivers.Do I really need drivers for the device, or can I communicate with it as it is now.If I do need drivers, where should I start?What should I look into to get communicating with the device?
I am trying to retrieve an image from its URL as an array where each box represents the pixel value of the image.
View 3 Replies View RelatedI was wondering if i had to say simply retrieve data from a server whether it be simple plain text for variables or download whole files (FTP), what would be the best method for this? I would imagine there is a pretty big difference between retrieving text and downloading files but im just wondering what the best thing would be to research for both.
View 3 Replies View RelatedI'm trying to retrieve the Player object from my hash table so I can edit the content of that object. Here is what I have.
Player* HashTable::retrieve(char * key, Player& aPlayer) {
//calculate the retrieval position (the index of the array)
size_t index = calculateIndex(key);
//search for the data in the chain (linked list)
node * curr = table[index];
char id[100];
[Code] .....
Here I'm calling the retrieve and I need to return a pointer of that object.
Player* PlayerDB::FetchPlayer(char* name) {
Player* info = new Player();
out << "Fetching player " << """ << name << "" -- ";
if(h.retrieve(name, *info)) {
out << "Success!" << endl;
[Code] .....
And here is my call in main.
Player* outPlayer = NULL;
outPlayer = pdb.FetchPlayer("Sappho");
if (outPlayer != NULL) {
outPlayer->LevelUp();
}
I'm just trying to change the actual level of the player using the LevelUp function, but right now it is not making that change. I've been told I need to return a reference of the object in my retrieve function, but I thought that was what I was doing already.
Basically, I'm trying to figure out the index in an array from a pointer that is returned by either bsearch or lfind.
void *val;
void *begin = (char *)v->elems (I need to use this separate variable)
Then, I call on either search, which seems to be working fine...
val = bsearch(key, begin, v->count, v->elemsz, cmp);
I'm trying to do the following:
index = *(int*)((char*)value_to_find - (char*)start_ptr)/sizeof(cv->elemsz)
However it segfaults everytime I do this. My logic is that I cast both void pointers to type of char*, then subtract the distance b/w the pointers since you can't do pointer arithmetic on void. I divide this by the size of each element to return the index, which needs to be cast to an int. What am I missing here?
I wanted to retrieve all rows from database and display in listview using list<string>
con.Open();
MySqlCommand view = new MySqlCommand("Select Cust_ID,Fname,Mname from Customer;", con);
MySqlDataReader v1 = view.ExecuteReader();
while (v1.Read()) {
for (int i = 0; i < v1.FieldCount; i++){
result.Add(v1["Cust_ID"].ToString());
[Code] .....
i have a form in which i have a field date of birth , and a textbox to fill date of birth , when a person fills his date of birth like 01/01/1990 , then it will be saved into database , and when i retrieve this date form database then this comes 01/01/1990 12:00 AM , i want only date part from it.
This is my form to fillup date of birth
form.aspx
<tr>
<td width="30%">
Date of Birth
<br />
</td> <td style="width: 1px">
:<asp:TextBox ID="txtDateofBirth" runat="server" placeholder="dd/mm/yyyy"></asp:TextBox>
</td> <td class="td2">
</td>
</tr>
this is code for form.aspx.cs
SqlCommand cmd = new SqlCommand("insert into ApplicantForm(NameofApplicant, dateofbirth)" +
"values( @NameofApplicant, convert(Datetime, @dateofBirth, 103)", con);
cmd.Parameters.AddWithValue("@dateofBirth",txtDateofBirth.Text);
this is code for print of this date of birth
print.aspx
<asp:Label ID="txtDOB" runat="server" ></asp:Label>
this is code print.aspx.cs
SqlCommand cmd = new SqlCommand("Select * from ApplicantForm Where ApplicantId=" + ((Request.QueryString["ApplicantId"])) + "", con);
dr = cmd.ExecuteReader();
txtDOB.Text = dr["dob"].ToString();
How to shorten it but it would need the user to set a variable's value and use that variable to call the array element.
int main() {
const int size = 3;
int choice;
[Code].....
how would i recieve the latitude and longitude from this xml
XmlTextReader reader = new XmlTextReader
("http://maps.googleapis.com/maps/api/geocode/json?address=" + postcode);
it should reurn the array
the php code is :
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $search_code . '&sensor=false';
$json = json_decode(file_get_contents($url));
$lat = $json->results[0]->geometry->location->lat;
$lng = $json->results[0]->geometry->location->lng;
return array($lat,$lng);
I used to retrieve IP and NIC information by querying windows registry. Now I'm trying to use GetAdapterAddresses() API. Using GetAdapterAddresses() to get IP is not that easy, I need to dig a long deep as I check some examples so far, anyways my question is: Calling this API will return success on all versions of Windows ie: 32bits & 64bits ?
Though Microsoft has not opened any source, where this API is actually retrieving Windows IP information.?. Is it reading Registry or some windows file.
I have a class I use to store column data read from delimited text files.
Code:
class column_data {
// class functions here
public:
// initialize class members
column_data()
: header(""),
[Code] ....
Each column is read into the vector of string. Next the string data is copy converted to the vector of double or the vector of int depending on the data type. There can also be additional transformations of the data (normalization, scaling, etc) and the transformed data is copied to the transformed_double_data vector. I do end up with multiple copies of the data, but I can clear some of the vectors if I don't need all the versions of the data anymore. Each column object goes into a container like a vector of objects or map of objects depending on how I need to access the column data.
There are functions that calculate statistics on the data in the columns and the results are assigned to the object variables like validate_r2. There are separate statistics for each column, so it seems logical to store the results in the column object. This works well for statistics like validate_r2 (pearson's correlation coefficient).
The current issue is that I have other statistics like "pw50" that I need to calculate and store. The statistic is the percent within +/- 50 units and the request for pw50 is passed in from the command line. The issue is that there could be several of these and they can have more or less any value like, pw50, pw75, pw100, etc. Storing data like this doesn't fit into my scheme very well because I can't pre-declare a variable to hold the result for every possible option. I don't know in advance how many, if any, of these there will be. I was thinking of adding two vectors, one of string and one of double,
Code:
class column_data {
public:
// initialize class members
column_data()
: header(""),
type(""),
use(""),
validate_r2(0.0),
[Code] ....
For each of this type of statistic requested, I would push_back a label into the string vector and then put the result into the parallel position in the double vector. This seems like I would work, but there are probably some things that could be done with pointers that might be better. Another option would be a vector of objects where each object had a string value for the label and a double for the result. That would be more bullet proof as far as keeping the label and value together, but I have not ever nested objects in a class like that so I thought I would post. I don't know the syntax for declaring an object of class_b inside the definition of class_a. The need is to provide dynamic storage for an unspecified number of these statistics and a reliable way to retrieve the values using the label.
I am trying to read a tab delimited file containing 8 columns and store each element of the column as an 1-dimensional array. Though the program prints the strings correctly as in the commented printf but it doesn't give me first_col[0] value and so on. My code is as follows:
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {
FILE *int_file1;
int BUF = 1024;
[Code]...
The inputfile test.txt has the following elements:
34932 13854 13854 2012-01-07
172098 49418 53269 2012-01-07
-
-
-
I created a simple program that writes some text to two different text files. how to create a program that would retrieve the information from those two files, and put them in a single file, first the content of input1 and then the content of input2. how to do this. Here is the program that I created that creates the two files.
#include <iostream>
#include <fstream>
#include <string>
int main() {
using namespace std;
string input1;
ofstream fout("input1.txt");
[Code]...
I've created a text file with the numbers from 1-450. After writing code to retrieve and print out the contents in the text file, the compiler only printed out the numbers 124-450. Is there a reason why this is happening?
View 19 Replies View RelatedI am working on a linked list that instead of the traditional integer value for a data, i'm using my own class. Unfortunately when i do this, i cant seem to retrieve my data from my Node.
#include "Customer.h"
class Node {
// TO DO:: Fill in.
//Constructors and destructor
public:
Node();
Node(int atime, int ttime);
Node(int atime, int ttime, Node* nd);
[Code] .....
In my main code, I've been trying something like
Node* c = new Node(1,2)
Customer x = c->cust; // or Customer x = c->get_cust();
cout<<x.get_atime()<<endl;
cout<<x.get_ttime()<<endl;
It should be displaying 1 and then 2, but just outputs 0 and 0.
I am creating an employee details project, the image is getting stored in the database but i am not able display it in the picture box.
private void button1_Click(object sender, EventArgs e) {
SqlConnection con = new SqlConnection(Connectionstring);
con.Open();
SqlCommand cmd = new SqlCommand("select photo from emprecordtable where eid='"+comboBox1.Text+"'", con);
//SqlDataAdapter da = new SqlDataAdapter(cmd);
//DataSet ds = new DataSet();
[code] ....
In sql server i have table called emprecordtable and i have the fields eid, rfid, empname, designation, phno, addres, and photo which is the image field and i have given the datatype as image but in the database the image is getting stored as Binary Data.. So, how to display in the picturebox from the database.
Stored procedure functions about c program
View 1 Replies View RelatedHow to retrieve a list of GPOs that are currently applied to the workstation?
View 14 Replies View Related i am student working on a project in c# to maintain the datas from a solar battery monitoring.i already imported the datas from the battery monnitoring and saved them in mysql database and retrived the data in c#.
i have problem in retriving the data in accordance with the date and time range selection.
what i am trying to do is there are more than 1000 datas in the table if i select two date and time the datas in the table should cross check these dates and show all the datas in the table in between those date&time
I am maintaining a legacy VC++ 6 project.
When I use SHBrowseForFolder I can retrieve a PIDL of the selected folder and with this PIDL I can get the path with SHGetPathFromIDList.
Now, given a path to a folder, I want to retrieve its PIDL. How can I do it? I tried SHParseDisplayName() but seems that function is unsupported in VC++ 6.0
The documentation states that "An image list is a collection of same-sized images" [URL].....
But how do I retrieve that size? I have a pointer to an empty image list. The size was set during creation, but that's out of my control.
I am trying to retrieve information from a website [URL] .... and have written a C code as follows:
Code:
#include <stdlib.h>#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
int main(int argc, char* argv[]) {
/* Exit status to return */
int exitStatus = 0;
[Code] .....
The output of this program should be:
From To
4504111 B0LPF3
4504111 P62993
The first print option [printf("%s", url)] gives the url output as [URL] .... which on being manually pasted in any web-browser gives the correct output but the program fails to give the output.
I'm doing a card game and i'm unclear on how to retrieve the card by doing vectors. after i use use srand() in main and create a rand() in a function, how can i retrieve that random card 1-52?
so far i know that i have to find the length of the card. but i don't know why i have to save the location onto another variable and erase the card of the specified index before returning the card out the function.
int location = rand() % cards.size();
I don't know why i need to do this and how do i reinitialize the variable cards into another variable?