Welcome, Guest. Please login or register.

Author Topic: Learning C with the Amiga  (Read 32495 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show only replies by koaftder
    • http://koft.net
Re: Learning C with the Amiga
« Reply #134 from previous page: February 12, 2007, 10:37:30 AM »
c may be a pain for dealing with strings withouth a nice string lib but at least its not like vb.net on opening a file handle:

FILE * bla = fopen("c:\koft\pov.c","w");

vs

Dim bla As New System.IO.FileStream("c:\koft\POV.c", System.IO.FileAccess.Write)

(;
 

Offline Louis Dias

Re: Learning C with the Amiga
« Reply #135 on: February 12, 2007, 12:07:57 PM »
Quote

koaftder wrote:
c may be a pain for dealing with strings withouth a nice string lib but at least its not like vb.net on opening a file handle:

FILE * bla = fopen("c:\koft\pov.c","w");

vs

Dim bla As New System.IO.FileStream("c:\koft\POV.c", System.IO.FileAccess.Write)

(;


LOL, you make it sound like you typed every letter of that code.  The IDE's auto-complete and selection as soon as you hit the "." reduces the actually typing greatly.

Also, a simple:
imports System.IO

at the top of your code (similar to a #include) and all you'd need in the code is:

Dim bla as New StreamWriter("c:\koft\POV.c")
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show only replies by koaftder
    • http://koft.net
Re: Learning C with the Amiga
« Reply #136 on: February 12, 2007, 12:18:14 PM »
Quote

lou_dias wrote:

LOL, you make it sound like you typed every letter of that code.  The IDE's auto-complete and selection as soon as you hit the "." reduces the actually typing greatly.

Also, a simple:
imports System.IO

at the top of your code (similar to a #include) and all you'd need in the code is:

Dim bla as New StreamWriter("c:\koft\POV.c")


that sample was from sample from koft.net

Yea, the IDE helps a lot. VisualStudio is top notch, and I use it for all my c/c++ development regardless if my stuff is targeted to linux or windows.

I know there are shortcuts but for a vb.net newbie coming from 10 years of vb experience ( started with 2.0 ) i found myself doing a lot of where.iswhatimlooking.for.inthe.framework.omg.its.all.thewayover.here?

and of course I hated that none of my code could easily migrate to .net. ):

Do we have a way in vb.net now to access lots of memory without using the dreded approach of multiple arrays each having less than 32k members or having to use a stinking collection class and stuffing data into strings to "hack" the ability to use megabytes of ram?
 

Offline mel_zoomTopic starter

  • Full Member
  • ***
  • Join Date: Jan 2007
  • Posts: 231
    • Show only replies by mel_zoom
Re: Learning C with the Amiga
« Reply #137 on: February 12, 2007, 12:19:21 PM »
lol!

Are you guys trying to put me off?
I love my MX5!
Please pay a visit
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Learning C with the Amiga
« Reply #138 on: February 12, 2007, 12:24:00 PM »
@mel_zoom

Nah, it's just a case of a holy war. ;-)
 

Offline mel_zoomTopic starter

  • Full Member
  • ***
  • Join Date: Jan 2007
  • Posts: 231
    • Show only replies by mel_zoom
Re: Learning C with the Amiga
« Reply #139 on: February 12, 2007, 01:07:12 PM »
I find it amusing that there is a vb.net versus C debate going on here when the whole point of the thread was specifically about learning C on the amiga :-)

First of all I want to learn C (with the aim of learning C++) and not VB. Second I wanted to use my amiga to learn it. Since no .net language is available on the amiga its irrelavent really.
I love my MX5!
Please pay a visit
 

Offline mel_zoomTopic starter

  • Full Member
  • ***
  • Join Date: Jan 2007
  • Posts: 231
    • Show only replies by mel_zoom
Re: Learning C with the Amiga
« Reply #140 on: February 12, 2007, 01:21:42 PM »
cymric:

I may be a beginner but I do understand that C is low level. Im not about to give up if I run into a problem handling an array.
I love my MX5!
Please pay a visit
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: Learning C with the Amiga
« Reply #141 on: February 12, 2007, 01:28:18 PM »
@Piru

Quote

C is nice since it doesn't restrict or limit you in any way if you prefer it that way. Still, you can use some very high level libraries that make your life very easy. The choice is yours, not something enforced by the language itself.

I'm not saying Python, or Ruby or other language sucks, these do have their applications. I say: Use whatever tool that fits your task. For me, C is the tool of choice.


Cymric is still having a point, I think. If coder is a beginner he is likely to get more done in Java than in C or C++. Threading, serialization, GUI support and everything else is readily available and almost the same everywhere.

Java is well suited for beginners while experienced developers find C/C++ more flexible. IMO.
My Amigas: A500, Mac Mini and PowerBook
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show only replies by koaftder
    • http://koft.net
Re: Learning C with the Amiga
« Reply #142 on: February 12, 2007, 02:06:01 PM »
Ive seen a lot of people get into coding and from what I have seen is that the language almost doesn't matter anyway. A newbie will either grab it by the horns and slog though it or give up.

A person who can't grasp dealing with functions or compiling hello world will flail just as badly regardless of whether they started out with c or perl or python or basic, etc.

C is a good start, it weeds out those who would give up regardless and sets a foundation that can be expanded to anywhere.
 

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show only replies by Cymric
Re: Learning C with the Amiga
« Reply #143 on: February 12, 2007, 02:16:17 PM »
Quote
mel_zoom wrote:
cymric:

I may be a beginner but I do understand that C is low level. Im not about to give up if I run into a problem handling an array.

That's perfectly okay, you need some persistence in order to learn programming in any language save for perhaps one: DWIM, Do What I Mean. You're perfectly fine with momentarily forgetting what I wrote as well---but remember that I wrote it once you begin coding big projects, and that you will require lots of extras to keep those managable. For now, concentrate on the basics, and even more importantly, enjoy yourself :-D.

@Piru:
Yes, using libraries is of course the way to go with C, I'm not at all disputing that. I'm also not trying to woo you away from your C-compiler: I too am very fond of my little blurbs of C with all their idiosyncracies, although I'm not experienced enough to do rapid prototyping with the language. I need something like Python etc. for that.
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Learning C with the Amiga
« Reply #144 on: February 12, 2007, 03:17:28 PM »
To be fair, designing my own libraries that wrapped up the OS behind my own class interfaces was more fun than writing the applications :lol:
int p; // A
 

Offline falemagn

  • Sr. Member
  • ****
  • Join Date: May 2002
  • Posts: 269
    • Show only replies by falemagn
    • http://www.aros.org/
Re: Learning C with the Amiga
« Reply #145 on: February 12, 2007, 03:18:54 PM »
Guys,

To me it looks like Mel is clever enough to overcome all the little nitty-gritty details that may have put some of you off. Pointers, strings, arrays, are a non issue for some people, even if C is their first language. And something tells me C isn't the first language for Mel.

Besides, many of the issues that some of you guys have raised about C are just non existent in C++: C++'s got a pretty decent string class, bound-checked arrays (vector class) and pretty nice memory handling classes (boost's shared_ptr class comes to mind).

Mel, I don't know what kind of role and expertise you have in your company, but if you're even slightly interested in general Computer Science, with some math background, and are as fascinated by languages in general even just one third than I am, then once you've grasped the basics of C, C++ and the Boost Library will be your "paradise" (for lack of better term). :-)
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show only replies by SamuraiCrow
Re: Learning C with the Amiga
« Reply #146 on: February 12, 2007, 05:40:51 PM »
... or if you want non-buffer-overflowing strings in C and don't mind being GPL or BSD licenced, download the Better String library for C/C++.  It supports length-terminated strings with adjustable buffer sizes for proper and fast concatination.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Learning C with the Amiga
« Reply #147 on: February 12, 2007, 10:13:56 PM »
You know, I've written countless thousands of lines of C and C++ code by now. You know how many times I actually *needed* to directly concatenate a string for anything (as opposed to just reading/writing to some device or setting properties of some object)?

I can probably count it on the fingers of one hand. Unless you are specifically working on code that makes heavy use of text parsing I really think the issue is blown out of proportion.
int p; // A
 

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show only replies by Cymric
Re: Learning C with the Amiga
« Reply #148 on: February 13, 2007, 12:19:36 AM »
Applications vary. I've had to code more text parsers to read out so-called universal file formats of weird scientific equipment than I care to remember.
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Learning C with the Amiga
« Reply #149 on: February 13, 2007, 09:00:14 AM »
@Cymric

I've had to do a lot of text parsing too and even then I rarely needed to concatenate strings. There are usually solutions you can come up with that don't require endless reallocation and strcat ;-)
int p; // A