Hello everyone!
I'm new around here, but that's pretty obvious. So I'll your time by skipping the introduction and getting right to the code.
I decided to start learning C the other day. Now, I'm new to C itself, but not its syntax; I've done quite a bit of programming in a few of C's derived languages.
After a couple "Hello, world" type programs, I decided to write a BASIC interpreter in C as my first real project (and yes, I know what I'm getting in to... ;-) ) It's called Portable BASIC, and a stable version of the source is available here. (Compiles with TCC on Android.)
Anyways, I've begun work on implementing the print statement. What I'm having trouble with is getting the string to be printed.
Portable BASIC is a line-by-line interpreter, and it reads the instructions out of an input string.
I'm trying to use this code to retrieve the print string, but I keep getting a Segmentation Fault on the second printf.
String is defined as a type earlier in my program, as an array of chars. comStr is the command line received from the interpreter.Code:printf("%i", strlen(comStr)); string check; for(i=0;i <= strlen(comStr) -6; i++) { check[i] = comStr[i+5]; } printf("%s", check);
I want check to display the rest of comStr after the first quotation mark.
Any ideas?