[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] XaAES crash errors



On Sat, Dec 5, 2009 at 12:21 PM, Paul Wratt <paul.wratt@gmail.com> wrote:

> Also, can anyone tell me how to initialize a CHAR var when you dont
> know what the max length will. I have had no success in either a net
> search, or looking through the code (for other uses of it)

A char is exactly one byte. In C, strings are made with arrays of type
char - that means what you are looking for is not char, but pointer to
char!

Dynamically sized strings can be made with malloc. There is also a
bunch of functions with names starting with str, like strcpy, which
means there is no need to reinvent a bunch of wheels for each piece of
software written. Please make yourself familiar with pointers and the
standard libraries. Vast amounts of documentation on this on the
web...

One suggestion for reading is
http://publications.gbdirect.co.uk/c_book/chapter5/character_handling.html
- although knowing pointers and arrays first is probably a good idea.
Also, any set of *nix manpages will be a great asset (esp. for the
string functions).

Best of luck :)

/Kåre