Easy Question

K

Kandy

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
 
J

JKop

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
 
V

Victor Bazarov

Kandy said:
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
 
J

JKop

Victor Bazarov posted:
Kandy said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top