473,383 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

prefix to an integer

15
I have an address of a dynamic memory which is 00355618 which is in a file. I want to read that address from there and then call delete to delete the corresponding memory address.
Please help
Mar 29 '09 #1
4 1904
weaknessforcats
9,208 Expert Mod 8TB
Well, assuming 00355618 is a valid address in your current program, which I doubt, you read the digits into a string, convert the string to an unsigned int and then typecast the unsigned int to the same type that was used with the original allocation.

However, I expect:
1) the 00355618 was written to the file and the program completed. Next time th program runs 00355618 is invalid.
2) the file contains 00355618 bit apparently not the type used to allocate it. That makes typecasting to the correct type iffy.


What you should be doing is reading the disc file into memory and allocaiting as you go. Then then the program is ready to complete, your write out from memory to the file the current data.

I have never seen an address in a file like this. File offsets, yes, but actual addresses no.
Mar 29 '09 #2
donbock
2,426 Expert 2GB
@vsachar
Generally, the term 'dynamic memory' indicates 'heap memory', that is, memory that is dynamically allocated while your program runs via either 'new', 'malloc', or 'calloc'. There is every reason to expect the address of such dynamic memory to be different every time your program executes. If that's the kind of memory you're trying to access then the worst thing you could do is hard-code the physical address.

By the way, the default interpretation of literal "00355618" is as an octal number (because of the leading zero). Is that what you want? You can certainly choose to interpret it as a decimal or hexadecimal number; but only if you know that's what you want.

On the face of it, your question leaves me with the impression that you are trying to do something ill-advised or even dangerous. Please provide more context for what is going on.
  • How did you find out that the address is 00355618?
  • What is this the address of (ie, char, int, float, structure, array, etc.).
  • If it is dynamic memory, then who allocated it?
  • If some other program or task allocated it, then are you sure you should delete it?
Mar 30 '09 #3
donbock
2,426 Expert 2GB
Argh ... this is a double-post! My reply of a few minutes ago was a waste of time. Refer to string to pointer for the more up-to-date discussion.
Mar 30 '09 #4
JosAH
11,448 Expert 8TB
@donbock
My bad, I didn't see it. Maybe those two threads should be merged or I should close one of them.

kind regards,

Jos
Mar 30 '09 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Holger Joukl | last post by:
Hi there, 2 questions regarding build/installation issues: 1. In the python 2.3.3 setup.py script, the detect_modules method of class PyBuildExt contains the following code: 253 if...
1
by: Romeo Disca | last post by:
Hello newsgroup, i'm new to xml - what's wrong with this piece code here? i have these two files: test.xml ---- <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE a SYSTEM "test.ent"
3
by: Jacques | last post by:
I'm experiencing the following problem The source xml file uses a prefix (wpl:) and look like this (shortened): ----------------------------------------------------------------- <?xml...
4
by: Krishna Tulasi via .NET 247 | last post by:
Hi, I am having trouble with creation of XML programmatically using .NET. Specifically Im trying to create an element which looks like below and insert into an existing xml doc: <Worksheet...
4
by: the hotshot | last post by:
hello, this seems to be a hard question so far and noone has been able to help with this. is it possible to have access start an autonumber with a prefix according to the year when the data is...
6
by: blue875 | last post by:
A tale of two queries: One query looks like this, and runs fine. We'll call this the "Customer1 query": SELECT Customer1 overall.*, IIf(IsNull(.),0,1) AS IsField, IIf(IsNull(.),0,1) AS...
4
by: BizTalk Benjamin | last post by:
Hi, I have an XmlDocument loaded from a memory stream. I set the document element prefix in this way XmlElement e = xDoc.DocumentElement; e.Prefix = "abc" When i simply write the document...
2
by: scottpet | last post by:
Hi, I want to add a namespace prefix to the root node of an object I am serializing to XML. I have been reading though this article:...
30
by: Xah Lee | last post by:
The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations Xah Lee, 2006-03-15 In LISP languages, they use a notation like “(+ 1 2)” to mean “1+2”....
8
by: subramanian100in | last post by:
Consider int i = 10; Why do we say that ++i yields an Lvalue and i++ yields an Rvalue ? I thought both these expressions yield only values. I am unable to understand the difference
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.