Welcome, Guest. Please login or register.

Author Topic: Understanding Strings  (Read 1523 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DrkStarrTopic starter

  • Newbie
  • *
  • Join Date: Aug 2016
  • Posts: 4
    • Show all replies
Understanding Strings
« on: August 30, 2016, 02:49:28 PM »
Hi everybody,
I've installed the latest SDK 53.30 on top of AMIGAOS 4.1 FE.
I'm compiling in the Shell, using GCC version 4.2.4.

The problem I'm having is with strings.  I don't really understand them.

I've looked around and I can't even do a strcpy.  It's pretty frustrating.

Code: [Select]

#include <stdio.h>
#include <string.h>
#include <proto/intuition.h>

UBYTE *taxString = &quot;100%&quot;;
UBYTE *taxPass = &quot;10%&quot;;

int void(main) {
    strcpy(taxString, taxPass);
    printf (&quot;Tax String: %s\n&quot;, taxString);
}


I can get the code to compile in GCC but it throws a Guru Meditation Error when I run it.  

I'm also placing taxString in a StringObject and it's throwing the same Guru.

I'm not sure what I'm doing wrong.  I've played around with the code a lot, but I can't get it to work.

- Thanks for the help
 

Offline DrkStarrTopic starter

  • Newbie
  • *
  • Join Date: Aug 2016
  • Posts: 4
    • Show all replies
Re: Understanding Strings
« Reply #1 on: August 31, 2016, 05:42:01 PM »
Thanks a lot, that worked.

I thought it might have something to do with the declaration, but there were so many different examples out there I couldn't figure it out.

And I guess I should start using -Wall.

- Really appreciate it :)