C++ :: Printing Data As It Is Stored In Memory (binary)?
Mar 21, 2013
So, if I'm right, computer store their data as binary values. So if I write int x = 5; , my computer converts the value of x from decimal (5) into binary (101) and stores it in memory as a a binary number. If I print that value on the screen that value is converted(by default) back into a decimal number before being printed on the screen.
Now, my question is if there is any way to print the value of x directly into binary(as it's stored in memory) without it being converted back into a decimal value?
View 10 Replies
ADVERTISEMENT
Mar 8, 2012
I am trying to write a client/server application that takes input to an array of structures from the user,stores the data in a shared memory segment and then writes the same to a file when I close the application. How do I get started? And how do I ensure that the server stores the data correctly? Also, the server needs to be a concurrent server that accepts connections from multiple clients.
View 1 Replies
View Related
Dec 6, 2013
Following is the program I wrote it basically takes 9 inputs and then save them into binary file. then print out the data stored in binary data and find inverse of it then print the inverse out. but its stuck in a loop somewhere.
Code:
#include <stdio.h>
int main() {
int a[3][3],i,j;
float determinant=0;
int x;
FILE *fp = fopen ("file.bin", "wb");
[Code] .....
View 6 Replies
View Related
Sep 19, 2013
I got an assignment at school asking for a program that can implement functions that store, get and deletes text/binary data to a given memory area. We are supposed to make kind of like a tiny-mini OS..any links to some tutorials or explanations hon ow to understand this and be able to make a program like this on my own?
View 9 Replies
View Related
Feb 9, 2015
Im trying to run my program and it works fine until the very end where I want it to read "<name> is a <gender> citizen of <nation>." with the corresponding variables. Here is my work for the time being. Also is there a way to make it where if someone puts a M or m for gender, it will spit out Male instead of just m or M.
#include <iostream>
using namespace std;
int main()
{
char gender;
[Code].....
View 2 Replies
View Related
Aug 23, 2014
For example when I have:
Class A{
B objectB;
};
Now when I instantiate the object of class A like:
main(){
A objectA;//option 1
A* pObjectA = new A();// option2
}
How is objectB stored in memory (stack heap etc.) for both options??
View 1 Replies
View Related
May 23, 2014
I'm playing around and wrote a tiny program.
Code:
char bracketin[] = "thisgetsbracketed.txt";
char bracketout[] = "bracketed.txt";
char testwalk[10] = "12345678";
[Code]....
I'm incrementing the pointer to buffer 150 bytes beyond its reserved 50. I see testwalk, followed by bracketout, followed by bracketin printed by the overflow on buffer.
The memory locations are ordered descending from their call order. Why is this the case?
One would think that they would be written in ascending order as I call them. I can only assume that they're compiled bottom up - where could I read about this process?
View 3 Replies
View Related
Jul 11, 2014
I am making a multiple quiz program. So everything is working fine, except for the part where i'm trying to add a highscore for each user which is being stored in a binary file. I have added a sample of the program containing the error. This isn't the actual program, which is very long.
class user { //The collection of all info pertaining to the users
char user_id[50];
public:
int hscore1;
user() {
strcpy(user_id,"NULL");
hscore=0;
[Code] ....
View 1 Replies
View Related
Jun 21, 2014
I am trying to build a employee management system using C, and I have done alot so far. Everything seems to work fine, but then I thought that I should let the user store the data of their employees permanently, therefore I created a file and then I store the user's given data in the txt file.
Here is the code:
#include<stdio.h>
#include<conio.h>
#include<string.h>
[Code].....
But there is some problem, and I don't seem to understand what is the problem in the code, it's just that whenever the user enters any id to search, and presses any key then nothing appears just a blank screen! I wanted to know that how can I check the ID from the text file and then display the details of the employee of that id!
View 1 Replies
View Related
Aug 13, 2014
How do I compare multiple datas?
I have climate data for 6 months and is trying to find the highest climate month among all 6 months. How do I do that?
View 2 Replies
View Related
Feb 1, 2014
It only prints out the root in an infinite loop.
Code: void Btree::printTree(Node* tree)
{
tree=root;
if (tree != NULL)
{
std::cout<<" "<< tree->key;
printTree(tree->left);
printTree(tree->right);
}
}
View 5 Replies
View Related
Apr 19, 2014
I am not sure how to use the parameters ostream and enum type in a print function.
enum TraversalOrderType {preorder, inorder, postorder};
template <class ItemType>
void Tree<ItemType>::print(ostream & Outstream, TraversalOrderType order) {
[Code] ....
Is this the correct way to call the print function?
int main() {
Tree<int> tree1;
tree1.print(cout, preorder);
return 0;
}
View 2 Replies
View Related
Mar 18, 2014
I am working on a program that needs to take any infix expression as an input. And the display the expression tree of it on the console as an output. For example the input goes (a+-(c*d) should output:
-
+ *
a b c d
View 1 Replies
View Related
Feb 5, 2014
I need to create a program which could create text files of the bits stored in avi file/binary file. My first requirement is to show 0s and 1s in the text representation . My second requirement is to create an avi file from this text file. I have tried few codings but either they give me error or they not playing the reconverted binary files.
View 6 Replies
View Related
Nov 21, 2013
Implementation of a simple binary tree. What I'm trying
#include <iostream>
using namespace std;
struct bintree {
int number ;
char letter ;
bintree *left = NULL ;
bintree *right = NULL ;
[Code] ....
It crashes when I try to print, I dont think it is inserting the last values into the tree and so when it trys to print a null value it crashes. I'm just curious if I'm heading in the right direction and perhaps how to fix my printing issue as well as some hints on deleting and searching.
View 3 Replies
View Related
Dec 6, 2013
I need to find inverse of a matrix data in binary file should be used to form matrix.its not finding inverse correctly rest is working good.
Code:
#include <stdio.h>
void createbin();
void display();
void inverse();
int main()
{
createbin();
display();
inverse();
[Code] ....
View 4 Replies
View Related
Dec 26, 2013
I am writing a program where I need to read a byte of char data and convert it into a text string of binary data that represents the hex value...
i.e. The char byte is 0x42 so I need a string that has 01000010 in it. I've written the following subroutine....
------------- My Subroutine ----------------------------------------------------------------------
void charbytetostring(char input, char *output){
int i, remainder;
char BASE=0x2;
int DIGITS=8;
char digitsArray[3] = "01";
[Code] ....
When I submitted the byte 0x42 to the subroutine, the subroutine returned to the output variable 01000010... Life is good.
The next byte that came in was 0x91. When I submit this to the subroutine I get garbage out.
I am using a debugger and stepped through the subroutine a line at a time. When I feed it 0x42 I get what I expect for all variables at all points in the execution.
When I submit 0x91 When the line remainder = input % BASE; gets executed the remainder variable gets set to 0xFFFF (I expected 1). Also, when the next line gets executed..
input = input / BASE; I get C9 where I expected to get 48.
My question is, are there data limits on what can be used with the mod (%) operator? Or am I doing something more fundamentally incorrect?
View 6 Replies
View Related
Aug 10, 2014
I have a file with data in it, and I'm trying to print that data, but it is:
1) not reading the last file (record #83)
2) it's printing out the last record twice (in this case, #77)
//record data for each tool
int recordNumber;
string toolName;
int quantity;
[Code]....
here is the printData() function
void Hardware::printData(int _recordNumber, string _toolName, int _quantity, double _cost)
{
cout << left << setw(10) << getRecordNumber() << setw(20) << getToolName()
<< setw(10) << getQuantity() << right << setw(10) << fixed << setprecision(2) << getCost() << endl;
}
View 9 Replies
View Related
Dec 6, 2014
i have project (person ID cared) and fortunately i could finish it in programming,,,,, but the thing that i don't know what to do about it is how to print this data? can i use reportviewer ?
View 4 Replies
View Related
Mar 30, 2014
I have created a template class called Queue that stores elements using linked list. I have also created a new type called Date.is there any way to output Date date using Queue functions?
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
template <typename T> struct node{
T value;
node<T> *next;
[code]....
View 3 Replies
View Related
Nov 23, 2013
I have a local student and international student class inherit from student class. read and print are virtual functions. After i have set all the member variables when i wan to print out all the student information, my program crashes.
Code: int main()
{
clsUniversityProgram objProgram[3];
for (int x = 0; x < 3; x++)
[Code] ....
View 4 Replies
View Related
Jan 31, 2015
So, it seems I have a bug in my code:
Code:
char *mem = malloc(9), *bottom = malloc(3), *in = "abc";
int position = 2, i;
mem = "onetwo";
printf("OLD mem = %s
", mem);
[Code]....
What I'm trying to do is insert "abc" in the 3rd position of "onetwo". Results would be "oneabctwo", but all I get is crashing.
View 9 Replies
View Related
Mar 27, 2013
Is it possible to store data to CPU memory, if so how much memory can I store and how? Say I wanted to store an array, about 6MB in size?
View 1 Replies
View Related
Nov 11, 2014
When I return mem add I cannot access the data in that add: in bin search tree
Curr=findMin(root);
cout<<"val: "<<Curr->barcode<<endl;
bst::hwareItem* bst:: findMin(hwareItem*& root){
while(root!=NULL){
root=root->left;
}
return root;
}
View 1 Replies
View Related
Jul 11, 2014
Using the C # programming language LED controller through which controls the array is connected to the controller via the RJ45 port. I already know the basics, I mean specifics, ie
Using the instructions and DLL included with the hardware, I want to read data from it, but I can not deal with it.
Model controller is "C-Power5200" and dll is "CP5200.dll".
I would like to:-pick the data-display-edit and - save in the controller.
To read the data I am using the function
CP5200_Net_Read (BYTE * pBuf, int nSize);
and to save
CP5200_Net_Write (const BYTE * pBuf, int nLength);
View 2 Replies
View Related
Jul 26, 2014
I have a csv file (comma delimited text file really) and I have data ,about 6400 lines, and I need to read and display data from 1 line. At the bottom is sample data from my csv file.
I want to read onto the screen the 3rd item .. ie Test User 1 and the date and time at the end (the last 2 items).
I will enter in a number .. from which I will want to retrieve the appropriate record .. in this case I would enter in 514, 563 or 874 and get back the info for that record.
This is a DOS 16 bit application .. and I know that some of the data is in memory already but I am not sure how to tell .. or how to retrieve it.
I do have the ability to save the data to the file at any time .. so I can use that to ensure that the data is current in the text file before I retrieve the data from this 1 row.
I think that it may just be easier to get from the text file ? but I am not sure.
0000,7,0,"Test User 1",53c145cb,db,5,514,514,2014/07/12,10:27:23
0001,7,0,"Test User 2",53d7f,1903,10,563,563,2014/07/24,11:04:31
0002,7,0,"Test User 3",529c,5ffb03,0,874,874,2013/12/02,09:07:58
I am a database guy .. and I am just a bit lost when it comes to C programming as such.
View 9 Replies
View Related