Page 1 of 4
My dream begin....since 2 days i learning C
Posted: Sun Oct 31, 2010 6:50 pm
by Kwai chang caine
Hello at all my friends
Since 2 days i'm the more happy programmer of the world.... see my teeth
Because since twenty years i dream to programming in C, and never dare to try
So thanks to PB, now i can begin to learn the C
I'm very surprising to see, how my god have keep the format of the C for do his baby 
Sometime...i believe i'm in my favorite language, but no....i'm in C
I see the same things (Callback, API with no declaration like loving PB, etc ...) 
Yes, C is apparently much more difficult than PB, but FRED is a love, and he not want create another owner language, for make loose his clients in all this personals functions 
So i want to continue my project of a PB2C translater...
http://www.purebasic.fr/english/viewtop ... 37#p316737
Someone say that perhaps FRED can easily export C code of his compiler, i don't know if it's true ???
I know that nobody have interesting by that
, and everybody laugh when i propose that, but if i can translate 60% of PB, i'm not forcing to remember the complex syntax of the C, and just programming in PB for making C code or PB Code
So for do that, i need a little bit of help of my PB friends who know C 
I'm actually on a C forum, but sometime ....your advice is very very important for little KCC
Well ..when i have a question, i put it here, and if one or several member have the kindness to help me a little bit, i can perhaps do my children DREAM
Thank you very much in advance
Kcc the eternal programming dreamer
Re: My dream begin....since 2 days i learning C
Posted: Sun Oct 31, 2010 6:51 pm
by Kwai chang caine
Believe you it's dangerous to put the SWITCH on the While/Event loop ??
Code: Select all
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Because apparently the callback is the first way for detect windows events in C
But i want to know if, i can do like in PB...
Use the Event loop for the simple Event and remove the CALLBACK procedure...and just use callback, if i want numerous event or quick event
Re: My dream begin....since 2 days i learning C
Posted: Sun Oct 31, 2010 7:00 pm
by utopiomania
? Are you talking about C#, C++, or just plain C? If its the latter, stick to Basic instead.
I programmed in C, and fell into the trap of writing code so elegant I cant't comprehend
what it was supposed to do anymore.

Re: My dream begin....since 2 days i learning C
Posted: Sun Oct 31, 2010 7:16 pm
by Kwai chang caine
Hello UTOPIOMANIA
I talk about the one, alone and big
C
C like
Creator and base of nearly all what is exist like language

Re: My dream begin....since 2 days i learning C
Posted: Sun Oct 31, 2010 8:54 pm
by utopiomania
Ok, the
big C, nothing less. Cool, and good luck to you!
My C codes is on a 20cm high stack of 3.5" disks, so I can't help you with any examples right now.
Actually, they just caught fire. I hate C, I think. Anyways, good luck.
Re: My dream begin....since 2 days i learning C
Posted: Sun Oct 31, 2010 9:07 pm
by Kwai chang caine
My C codes is on a 20cm high strack
You can when even say your advice for my question if you have do C, about the loop of event ????
Is it possible or not to put directly the Switch inside ???
Anyways, good luck.
Thanks, i believe i need much much chance, you have right
So when i know nothing in PB, and less in C....it's a real adventure
The advantage with me, it's i'm not affraid because i don't know anything
It's the advantage of the uncultivated
I begin just to write the first function to translate "Enumeration"

The baby is again in my belly....i can even say...the ovule is again in my belly, that the more correct word
I want do function after function, first with the more simple...and even if i can not terminate all, and the code is translated at 60%, it's already better that nothing no ???
Me i like C....but i love PB and FRED much more....and with the power of PB we always say, we can do all the miracle..
It's the time to proof that
Thanks to your answer

Re: My dream begin....since 2 days i learning C
Posted: Sun Oct 31, 2010 11:51 pm
by Vera
Dear Kwaï chang caïne,
I wish good success with your joyful jump into C
If you like to have a large repository of well garded running code examples in direct comparison, then have a look at
RosettaCode (scroll down and choose one of the challenges). There you'll find PureBasic represented with already
341 solved solutions and C with
365.
(Tip: there's also a hard to come upon special page: Basic language learning)
nice greetings ~ Vera
Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 12:24 am
by Mistrel
All my "C" code is in "C++". You're on your own, Kwaï.
Good luck.
Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 12:33 am
by c4s
Mistrel wrote:All my "C" code is in "C++". You're on your own, Kwaï.
Good luck.
Finally you found a good situation for this smiley.

Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 1:59 am
by Mistrel
c4s wrote:Finally you found a good situation for this smiley.

I thought it was pretty clever as well.
It was Vera's emoticon that gave me the idea.
Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 8:40 am
by Kwai chang caine
@VERA
Thanks for the link, i have forgotten the rosetta way
I take a look also to the other link
@MISTREL
It's a pity
I believe there are much member who know the C in this forum
I continue alone like usually
Thanks when even for your answer
I wish at you two a good day

Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 10:08 am
by Kwai chang caine
In fact the real question is :
Do you think that FRED use when even and in all case, the Callback when he have created the function
Code: Select all
Repeat
Evenement = WaitWindowEvent()
Select Evenement
Case #PB_Event_Gadget
EvenementGadget = EventGadget()
EndSelect
Until Evenement = #PB_Event_CloseWindow
Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 10:33 pm
by milan1612
Kwaï chang caïne wrote:Code: Select all
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Seeing this piece of code I can't resist giving you some advice.
What you're writing here is C like it's being used in the Windows API. You shouldn't use
the Windows API when you're just about to learn C. The Windows API is one of the ugliest
pieces of C code I've ever seen. It won't teach you good C programming.
You really should start to learn the language first, then the libraries. Write a small
console application without using anything but the standard C libraries. Become famliliar
with common patters used in C programs.
I fell for this trap too, trust me...
Or better yet, learn C++ from the start

Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 10:47 pm
by Kwai chang caine
Thanks to your advice MILAN1612
I know you have right

But my goal is to can create my translater PB/C
And especially how create a windows with API
But in the same time, i learn a little bit the C, and especially how use IDE VC6++
It's a hard works especially for little KCC, i move slowly, but i move.
If i like do the C, obviously i continue to learn with good method..
And i want to stay in C, not C++, i don't like POO too, it's for this reason that i love and use also PB, i just like procedural programming
I know KCC do always all the things back to front

I hate the console, and never do something with it, even in PB
I know i have wrong, but if i don't see a windows ..i'm sad
It's a reason why, i never use linux too
Thanks to your advice very important for me
At the pleasure to read you
Re: My dream begin....since 2 days i learning C
Posted: Mon Nov 01, 2010 11:44 pm
by LuCiFeR[SD]
Grasshopper my old friend... Do not run before you have learned to walk
