Hi,
Please check whether the following block of code is correct or not. -
items[index] = 0; // Add an end of list marker
-
-
// Add the data to the blob
-
-
if (blob_ptr != 0)
-
{
-
long additional_space = 0;
-
-
char** item_ptr = items;
-
-
// Calculate the space taken by the new items
-
-
while (*item_ptr != 0)
-
{
-
additional_space += strlen(*item_ptr);
-
-
item_ptr++;
-
}
-
-
// Increase the size of the blob for the new items
-
-
blob_ptr = realloc(blob_ptr, blob_size + additional_space + 1);
-
-
item_ptr = items;
-
-
// Loop through the items and add them to the blob
-
-
while (*item_ptr != 0)
-
{
-
strcat((char*) blob_ptr, *item_ptr);
-
-
delete *item_ptr;
-
-
item_ptr++;
-
}
-
-
// Set the new size of the blob
-
-
blob_size = blob_size + additional_space;
-
}
-
Please help me. Thanks in advance.
2 1185
Hi,
Please check whether the following block of code is correct or not.
items[index] = 0; // Add an end of list marker
// Add the data to the blob
if (blob_ptr != 0)
{
long additional_spac e = 0;
char** item_ptr = items;
// Calculate the space taken by the new items
while (*item_ptr != 0)
{
additional_spac e += strlen(*item_pt r);
item_ptr++;
}
// Increase the size of the blob for the new items
blob_ptr = realloc(blob_pt r, blob_size + additional_spac e + 1);
item_ptr = items;
// Loop through the items and add them to the blob
while (*item_ptr != 0)
{
strcat((char*) blob_ptr, *item_ptr);
delete *item_ptr;
item_ptr++;
}
// Set the new size of the blob
blob_size = blob_size + additional_spac e;
}
Please help me. Thanks in advance.
You are using pointer to pointer,
char** item_ptr = items;
This is a good idea when u want to use item by item. Use pointer to array.
To the OP: Please use code tags. Read the Reply Guildelines Box to the right of the message window.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Edward K. Ream |
last post by:
Hello all,
First of all, my present state of mind re pep 318 is one of sheepish
confusion. I suspect pep 318 will not affect Leo significantly, but I am
most surprised that an apparently controversial feature is being added
without a notice, say, in comp.lang.python.announce. I say sheepish,
because everyone knows that one should make sure new proposals don't bite
you. Still, I would have thought that there were other ways of keeping...
|
by: Florian Brucker |
last post by:
Hi!
I've got a problem with float & clear. Take this example code:
<div style=" width:100px; height:100px; background-color:#FF0000;
float:left; margin:10px;"></div>
<span style="clear:left;">This is some text</span>
In Mozilla 1.6 the span still floats around the image on the left side
(as if there wasn't a "clear" option). When I use
|
by: yawnmoth |
last post by:
In IE6, setting clear to both in a span tag seems to work, whereas it
doesn't seem to work in Firefox. A demonstration can be found here:
http://www.frostjedi.com/terra/dev/test3.html
Any ideas as to why this might be, and what can be done to make
Firefox's rendition of the page the same as IE6's, without using div?
Also, I tried replacing nested css stuff (ie. #div3 p, #div3 span) with
their own id's (ie. #p and #span) and am now...
|
by: Paul E Collins |
last post by:
Hello.
I want to display a number of individual blocks of text. Each block
has an associated image, which should be displayed on the right and
aligned with the top of its block of text, i.e.
(use a fixed-width font to view this!)
Some short text. +-------+
| |
+-------+
|
by: cppdev |
last post by:
Hi All!
I want to clear the string contents from sensitive information
such as passwords, and etc.
It's always a case that password will appear as string at some point
or another. And i feel uneasy leaving it hanging in memory indefinitely
(especially in case when string is Interned).
So at leats for the case when string is not interned i propose:
| |
by: Lalatendu Das |
last post by:
Dear friends,
I am getting a problem in the code while interacting with a nested
Do-while loop
It is skipping a scanf () function which it should not. I have written
the whole code below. Please help me in finding why such thing is
happening and what the remedy to it is. Kindly bear with my English.
int
main ()
|
by: utab |
last post by:
Dear,
I have experince in C( numerical projects, like engineering problems,
scientific applications) I have the basic notion of C++ also, I have
read Accelerated C++ until Chapter 7, however it seems that it
discusses the std and the other part of the language with your own
abstractions. Is that better to read a book first on the basic concepts
of C++ language (but not the C part) that gives the basics as if the
reader is a beginner...
|
by: iTISTIC |
last post by:
Developing a new app and am trying to make this my first truly
OOP/3-Tier app. I understand the principles of the presentation,
business, and data layers. I do, however, have some questions on where
certain functionality should be placed and how some things should be
implemented.
Let's use a simple example such as an application to manage customer
records (customer_id, first_name, last_name). I'd have a Customer
business object with ID,...
|
by: jhcorey |
last post by:
I have the code below that works fine. Note that CellSet does not have
a constructor, so I don't have a default way of initializing it.
If I try to do something else in the catch block, either
ExceptionManager.Publish(ex);
or simply commenting out the line, I get a compile error:
"Use of unassigned local variable myCellSet".
Can anybody explain what is going on?
TIA,
Jim
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |