C :: Locations In The RAM Addressed Per Word Or Per Byte?

Sep 20, 2014

Are locations in the RAM addressed per word or per byte? I am using a 32 bit machine, so I think that it means that on my PC a word would be 4 bytes.

View 11 Replies


ADVERTISEMENT

C :: Tictactoe X And O Locations

Jan 26, 2013

I've made a tictactoe game using ncurses functions such as mvaddch to put x and o on my board. I need to somehow find the locations of the x's and o's so that i can win my game.

View 10 Replies View Related

C :: Write At Random Memory Locations

Jan 29, 2014

I have a complex program, around 25.000 code lines. It is quite stable, but I have a bug which only happens from time to time, and when in online-mode, so it is quite difficult for me to reproduce it. I have put lot of efforts to see where the problem is, and I have seen where the code crash, but that line is not the culprit, it only refers to read a memory location where it is supposed to be good data, and it is not. The real bug has happens before in execution. That data is read-only, I mean, I only compute it at program start-up, and then never write into it again, but my bug write to it doring code run, maybe because bad pointers address in any place, and look ramdom (different snapshots execution write at different memory locations).

My question is, is there a way to know when my code 'write' into that 'to me protected memory'? I thinking if there is a method to make a hash of all variables and arrays in that memory section, or any way to 'assert' when that big memory section is written, taking into accound that when I refer to that memory section it could be any of the lots of variables and arrays I precompute at start-up.

View 2 Replies View Related

C++ :: Hangman Definition Game - Extract Word Randomly Form File And User Guess The Word

Jun 25, 2014

Basically I have a text file called words. I'm supposed to extract a word randomly form the file and have the user guess the word. If they guess the word correctly in x number of tries they will receive the definition.

I'm having trouble receiving that random word and I'm getting the definitions from the file.

Here's my code:

#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

[Code] ....

This is what is in the words.txt file
apple#the usually round, red or yellow, edible fruit of a small tree
boat#a vessel for transport by water
horse#a solid-hoofed plant-eating domesticated mammal with a flowing mane and tail, used for riding
television#a system for transmitting visual images and sound that are reproduced on screens
soup#a liquid dish, typically made by boiling meat, fish, or vegetables, etc.
bottle#a container, typically made of glass or plastic and with a narrow neck
barber#a person who cuts hair
toast#sliced bread browned on both sides by exposure to radiant heat
radar#a system for detecting the presence, direction, distance, and speed of aircraft, ships, and other objects
red#of a color at the end of the spectrum next to orange and opposite violet

View 3 Replies View Related

C :: Display Function Displays All Letters Of Word Entered Instead Of Word Itself

Feb 18, 2013

I am building a linked list and i need to display function i have. The display function displays all the letters of the word entered instead of the word itself. below is my struct, one of my functions and the display function.

Code:

//-----------struct ------------//
struct Node
{
char data;
struct Node *next;
}*Head;

[code]....

View 1 Replies View Related

C++ :: Program That Reads A Word From User And Then Print (cout) This Word

Oct 24, 2013

I'm learning programming, and C++. I've got a question, but I couldn't solve my problem so far. I need to use arrays and only basic stuff to solve this:

Create a program that reads a word from the user and then print (cout) this word on contrary. It's simple, I know, but I can't do it,. I've tried some stuff but I don't get how I will get the proper values to do this. All I know is that I can use variable.lenght().

View 7 Replies View Related

C/C++ :: Opening Word Document In Turbo Or Any Program In Word Format

Mar 20, 2013

I have a problem to open word document into turbo c++. i don't know how to open if the documents are in word format.

View 1 Replies View Related

C/C++ :: Convert 1st Letter Of Each Word To Uppercase And Then Display Only The Last Word?

Dec 27, 2013

I want a program to display as follows..

if i enter mohandas karamchand gandhi i want output as M K Gandhi.....

i want the c++ code for this program..my error is i am not able to erase the letters of first 2 words..ie my output is Mohandas Karamchand Gandhi..

View 2 Replies View Related

C++ :: Simple Word Counter - Show Repetition Of Word

Apr 25, 2012

I've taken part the text into 1 word per line, but I can't figure out how to printf every word only once and then add (%d) in the end to show how many repetitions of that word there are.

Code:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
int main(){
char *oneword;

[Code] ....

View 3 Replies View Related

C :: How To Find Word And Insert Another Word After That In Text

Dec 20, 2013

I have text (string) and I want to find a given word (it's ok!) and then insert another given word after the first word. The original string is beeing copied into a new string. But something is going wrong!!! Where is my mistake?

(I have some patches...)

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//insert "new_word" after each occurence of "word"
int main(){
char A[100]="In the sentence words the and the.";

[Code]...

View 8 Replies View Related

C++ :: Fstream Class Not Reading Word For Word

Aug 6, 2013

int countTextWords(ifstream * file)
{
string textWord;
int wordCount = 0;
while((*file) >> textWord)
{
wordCount++;
}
return wordCount;
}

for some reason, (*file) >> textWord will not read words into the string. What am I doing wrong?

View 9 Replies View Related

C++ :: Word By Word From A Line In File?

Aug 14, 2014

ow to read word by word from a line in file into struct. Say for example:

12345 Joe Lim KH879.00
12233 Kay Suet Yee35.98

to

struct master {
unsigned short int IDnum;
char name[30];
float salesCustomer;
};

View 1 Replies View Related

C++ :: How To Read A Bit From A Byte

Mar 30, 2013

What is the most efficient way to read a bit at a particular position in a byte?

View 13 Replies View Related

C++ :: String To Int To Byte?

Aug 16, 2014

Right now im creating a program that use xbox inputs and then send out keyboard functions using sendInput();

It works fine, but now im creating a system wich lets the user of the program change the settings in a textfile. Wich will then change what the controllers bindings are.

example, if settings.txt says: Y=button(0xIE)

i want the program to know that when xbox button Y is pressed, execute a sendInput function to the Key: A (0xIE).

The problem is that the virtual keycode (0xIE) i take from the settings.txt is stored as a string (lets say it is stored in string Y_event)and input.ki.wScan has to be of type BYTE. i made a function wich changes string into int. (because input.ki.wScan seems to be fine getting a int?)

int stringToInt(string insert) {
char back[20];
for(unsigned int e=0;e < insert.length();e++) {
back[e]=insert[e];
} return atoi(back);
}

but when i run the code nothing happend...

In the code i have a function wich executes the keypress: void pressbutton(int key, int time)

when i send in the converted string it doesn't work but when i send in: (0xIE) it works.

pressButton(stringToInt(Y_Event),50) // doesn't work
pressButton(0xIE,50) // works

focus on the last part that i wrote.

View 3 Replies View Related

C :: Word By Word Search

Apr 25, 2013

i'm making a program for basic data entry.i have also included search feature which uses strcmpi() function.if i have a file name'report on tigers' and someone searched for 'tigers' then that person will not find the required file.any way i can overcome that ?

View 2 Replies View Related

C++ :: Most Efficient Way To Read A Bit From A Byte?

Mar 30, 2013

What is the most efficient way to read a bit at a particular position in a byte?

View 3 Replies View Related

C/C++ :: Returning Byte Value From Memory?

Mar 16, 2014

I'm trying to get the current time for a game and print that to the games chat window. I'm already injected into the process do I don't think I need ReadProcessMemory.

The value i'm trying to read is the game hours 1-12.

//doesn't work
byte time_hour_get ( void )
{
return *( byte *)0x00B70153; //the address to the memory containing the
}

addMessageToChatWindow((char*)time_hour_get); -> when I call this function it looks like s , . I want it to return the integer value like cheat engine. I used byte when scanning for this address

View 1 Replies View Related

C :: Byte Ordering In Binary Buffer

Apr 13, 2014

Basically it has to do with the byte ordering in a binary buffer vs the typing of a variable used to hold it.

To give you an example, if I have a buffer (say of indefinite length), and a ptr "ptr" pointing to a byte in the buffer (say, C0), such that if I open the buffer in a binary viewer it reads like this: Code: C0 DD FE 1F Such that this is true:

Code:
/*ptr is uint8_t*/
*ptr == 0xC0

Then I do this:

Code:
uint16_t var;
var = *(ptr+1);

I would expect the result to be:

Code: DD FE /*56830*/

Though if I print that out with:

Code:
printf("%u
", var);

It'll print:

Code: 65245 /*(FE DD)*/

Now obviously it's byte swapped, but what is causing that? I'm assuming if I just stream that out to a file byte by byte it'll be fine, so it's something with the 16 bit data type (also have seen this issue with a 32 bit data type, where all 4 are in reverse order). Is there any way to 'fix' it except bit shifts & masks?

View 14 Replies View Related

C# :: Reading A File Into A Byte Array?

Jun 25, 2014

I basically want to create a save editor application that will enable people to alter various values in the save by clicking on releveant buttons and then also for the editor to auto update the checksum when changes are done.

The save file is in hex so from what I can gather I would need to create a button to open the file using 'open file dialogue' and then read the file into a byte array so that the values can be called at any time when a particular butto is pressed and the application will then seek to the point in the file to make the required changes.

View 3 Replies View Related

C# :: Get Posted File From Byte Array

Oct 7, 2014

I have an application that has its own embedded web server. I am trying to add jQuery/Ajax file upload capabilities to the application however, I am running into issues getting the posted file. The jQuery/Ajax portion is similar to this method here. Due to the way the webserver was written (its in a dll and I do not have access to the source), the posted file comes in as a byte[]. If I try to save the byte array directly to file using:

File.WriteAllBytes("path", ByteArray)

I end up with a corrupt file that I cannot open. I believe this is because the byte array also contains the posted file header info (Content-Disposition, name, filename, etc.). If I view the contents of the byte array using:

System.Text.Encoding.Default.GetString(ByteArray)
the header info can be viewed as:
------WebKitFormBoundaryQfPjgEVpjoWgA5JL
Content-Disposition: form-data; name="0"; filename="someimage.png"
Content-Type: image/png
‰PNG

Based on the selected file size and the size of the byte array, the entire file is in the byte array. How can I go about extracting and saving the posted file from the byte array?

View 2 Replies View Related

C# :: Reading Byte From Serial Ports

Jun 8, 2014

how to use this function:

ftStatus = myFtdiDevice.Read(readData, numBytesAvailable,ref numBytesRead);

to read byte from the serial port.This function is part of the DLL that came with the chip(FT2232D) I am using on my board.I want to use the function to read a byte from the serial port and then send the value to the Graphic user interface.Unfortunately I was unable to get the expected value on my GUI.If I send for instance 40,what I get on the GUI are letters instead of the number 40 or at times the GUI will not even respond.Below are my lines of code I used to read the byte from the serial port:

The following instructions are executed whenever the CHECKBOX is checked

private
void checkBox1_CheckedChanged(object sender, EventArgs e)
{
UInt32 numBytesRead = 0;

[Code].....

View 3 Replies View Related

C/C++ :: How To Write Byte In 8051 Correctly

Nov 16, 2012

i have a hex code and need to write it in 8051

if the hex code is
"11 22 33 44 55 66 77 88"
"88 77 66 55 44 33 22 11" (hexadecimal)

but the result is

11 22 33 44 55 66 77 88 FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

it is should be

11 22 33 44 55 66 77 88 88 77 66 55 44 33 22 11
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

problem is ...
it can not write second hex code
just only write first hex code

i use serial port , VB6 ,keil C

View 4 Replies View Related

C++ :: Binary IO - Read 4 Byte Int From A File

Feb 26, 2012

Trying to write very simple code to read a 4 byte int from a file.

code:

int tester;
FILE *fp;
fp=fopen("/home/bdluser/skeleton.blx","rb");
fread(&tester,sizeof(int),1,fp);
printf("tested 1 byte read should be 1: %i",tester);

I have tried editing the binary file....it outputs similar large numbers

00000000000000000000000000000001 outputs 808464432
0x00000001 outputs 808482864
0x10000000 outputs 808548400
10000000000000000000000000000000 outputs 808464433
x01x00x00x00 outputs 813183068
x00x00x00x01 outputs 813183068 same....

etc.etc. It just keeps returning the same large integers. I thought they were memory addresses but its consistent output/input so I guess not.

View 2 Replies View Related

C++ :: Printf With Signed Short / Byte

Jul 17, 2012

I am using print/sprintf with a "%i" format string. Works fine if the input is indeed a 32bit integer. But how can i put in 8/16 bit (ie short & byte) 'integers'? If i just throw them in, they are always taken as unsigned, as the topmost bit/s is/are casted to zero... [URL] ....

View 3 Replies View Related

C++ :: Check If Given 8 Byte Is A Valid Double

May 28, 2014

Is there a function in C/C++ that can check if a given 8-byte data block is a valid double value in the valid range?

View 7 Replies View Related

C++ :: Byte Array To Double Conversion?

Dec 5, 2014

I'm trying to understand why a conversion from a byte array (unsigned char) to a double works when done one way and not antoher.

In the example code I test by hard coding an unsigned char array of the same bytes that the double consists of.

When I copy the bytes to a long long and cast to double the result is not the original double but if I use a struct the bytes can be set and the conversion happens.

Seems to me that both ways should work. I'd just like to know what is going on with the "struct way" that makes the conversion correct. I see in debugger that the bytes in memory are the same for piAsLong and u.bytes.

My compiler is VS 2012 and a long long and double are both 8 bytes (tested with sizeof). This is learning activity only.

Code:
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
union {
double d;

[code]....

View 6 Replies View Related







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