Chodzi mi o taką funkce, która zeruje całą tablice.
Czy jest coś takiego??
Jeżeli nie to jak to można w łatwy sposób zrobić??
Pozdro [???]
Chodzi mi o taką funkce, która zeruje całą tablice.
Czy jest coś takiego??
Jeżeli nie to jak to można w łatwy sposób zrobić??
Pozdro [???]
jest - nazywa sie petla
memset(tab, 0, sizeof tab);
Jak na to wpadłeś?? :-P
Nie, ale mi chodzi tak na serio czy jest coś takiego czy po prostu tak jak mówisz.
Dajesz pętle, która nadaje każdemu elementowi wartość NULL albo "".
Pozdro
Jedno pytanie IMP
O co w tym chodzi?? -> :-|
'memset' : cannot convert parameter 1 from 'class CStringArray' to 'void *'
I co z tym zrobić?? [???]
Pozdro
Możesz napisać tak:
memset(&a, 0, sizeof a);
ale nie gwarantuje rządanego efektu: funkcja memset wypełnia tablice, ewentualnie struktury ale o klasach nic nie słyszałem ;>
cannot convert parameter 1 from 'class CStringArray' to 'void *
Zapomnij o takim traktowaniu klas... Wystarczyloby w google wpisac CStringArray, a pierwszy link prowadziłby m.in. do:
CStringArray Class Members
Construction
CStringArray Constructs an empty array for CString objects.
Bounds
GetSize Gets number of elements in this array.
GetUpperBound Returns the largest valid index.
SetSize Sets the number of elements to be contained in this array.
Operations
FreeExtra Frees all unused memory above the current upper bound.
<b><u><font color=red>RemoveAll Removes all the elements from this array.</font></u></b>
Element Access
GetAt Returns the value at a given index.
SetAt Sets the value for a given index; array not allowed to grow.
ElementAt Returns a temporary reference to the element pointer within the array.
GetData Allows access to elements in the array. Can be NULL.
Growing the Array
SetAtGrow Sets the value for a given index; grows the array if necessary.
Add Adds an element to the end of the array; grows the array if necessary.
Append Appends another array to the array; grows the array if necessary.
Copy Copies anolther array to the array; grows the array if necessary.
Insertion/Removal
InsertAt Inserts an element (or all the elements in another array) at a specified index.
RemoveAt Removes an element at a specific index.
Operators
operator [] Sets or gets the element at the specified index.
// ludzie czytajcie helpy
To jet tablica String'ów, a nie ciąg znaków String.
Tablica ta ma 20 elementów i każdy ma być wyzerowany.
IMP <- twój kod nie działa.
Pozdro
IMP <- twój kod nie działa
Kompiluje się dobrze, a że nie działa tak jak chcesz to wcale mnie nie dziwi ;p
Podaj deklarację tej tablicy.
Spoko :)
Już wszystko mam.
Wykorzystałem rade Flabry.
Zrobiłem to tak:
tablica.RemoveAll();
i po kłopocie
Wielkie THX Flabra
Pozdro