473,320 Members | 1,699 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,320 software developers and data experts.

Easy Question

I allocated some memory with malloc
ligneb[indx]=(short*) malloc ((strlen(buffer)*8)+1);

but know I need to insert the single value inside
ligneb[0] I need to insert all my binary value

How can I increase the position?
How can I jump to any position?

Thank you


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 22 '05 #1
3 1070
Kandy posted:
I allocated some memory with malloc
ligneb[indx]=(short*) malloc ((strlen(buffer)*8)+1);

but know I need to insert the single value inside
ligneb[0] I need to insert all my binary value
As with all languages, English is no different in that one must must specify
to which particular article they are referring before they may actually use
the definite article indicator, ie. "the". "the single value" is undefined.
Improve your grammar and try again.

How can I increase the position?

Once again, "the position" is undefined.

How can I jump to any position?


As above.
-JKop
Jul 22 '05 #2
Kandy wrote:
I allocated some memory with malloc
ligneb[indx]=(short*) malloc ((strlen(buffer)*8)+1);

but know I need to insert the single value inside
ligneb[0] I need to insert all my binary value

How can I increase the position?
How can I jump to any position?


I have no idea what you're talking about. What is 'ligneb'?
What single value are you inserting into 'ligneb[0]'? How
was 'ligneb[0]' allocated?

If you need to increase the length of a dynamic array that
was allocated using 'malloc', use 'realloc'.

In most cases, if you're trying to use C++, malloc and any
other C memory management functions just don't cut it. Neither
do 'new' and 'delete', for beginners, anyway. Try using the
standard containers. E.g., instead of

short *ligneb[somany];

do

std::vector<std::vector<short> > ligneb(somany);

and anything growing from that...

Get a good C++ book.

V
Jul 22 '05 #3
Victor Bazarov posted:
Kandy wrote:
I allocated some memory with malloc
ligneb[indx]=(short*) malloc ((strlen(buffer)*8)+1);

but know I need to insert the single value inside
ligneb[0] I need to insert all my binary value

How can I increase the position?
How can I jump to any position?


I have no idea what you're talking about. What is 'ligneb'?
What single value are you inserting into 'ligneb[0]'? How
was 'ligneb[0]' allocated?

If you need to increase the length of a dynamic array that
was allocated using 'malloc', use 'realloc'.

In most cases, if you're trying to use C++, malloc and any
other C memory management functions just don't cut it. Neither
do 'new' and 'delete', for beginners, anyway. Try using the
standard containers. E.g., instead of

short *ligneb[somany];

do

std::vector<std::vector<short> > ligneb(somany);

and anything growing from that...

Get a good C++ book.

V


Don't feed the trolls!
-JKop
Jul 22 '05 #4

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

Similar topics

1
by: rdsteph | last post by:
I am having a lot of fun using the pyGoogle module ( http://pygoogle.sourceforge.net/ ) that uses the Google API. It is about as easy to use as I can imagine, and it is a lot nicer than using my...
0
by: | last post by:
I don't know SQL at all, but I have a problem now because I must use SQL in my PHP scripts. So please help me! I have 2 tables: id | name ----------- 1 | thing1 2 | thing2 3 | thing3 4 ...
5
by: LedZep | last post by:
What up, All I need to do is enter a last name in a text box, query a MSAccess database and display the name with the corresponding columns. This is no problem, but when there are more than one...
1
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real...
13
by: Ghislain Tanguay | last post by:
I have a compiled vb.net app and I want to give the user a choice to launch it from the start line command and pass it a parameter or not. How can I do that in my code? Is it possible? Ex. :...
1
by: melanieab | last post by:
Hi, If there's a textbox and the text entered is longer than what's visible (the textbox length), how do you make it so that the beginning chunk of text is visible (instead of the last part of...
23
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
6
by: Martin Bootsma | last post by:
I have a C question, which looks very easy, but no one here seems to know an easy answer. I have a function "powell" (from Numerical Recipes) which takes an argument of the type "double...
27
by: smnoff | last post by:
How does( or should user use) strncpy() to allocate enough memory space for the destination string, s1? I guess I am having trouble using strncpy as it seems to be giving me errors. And just...
9
by: rynTAU | last post by:
This is an easy question, I'm sure but I can't seem to figure it out. I'm trying to use the number_format() function to remove all decimal places from a number. $num = number_format($num,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.