Posts
 
Reputation
Joined
Last Seen
Ranked #381
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
73% Quality Score
Upvotes Received
11
Posts with Upvotes
7
Upvoting Members
8
Downvotes Received
3
Posts with Downvotes
3
Downvoting Members
3
10 Commented Posts
~33.0K People Reached
Favorite Tags

83 Posted Topics

Member Avatar for DemonLady

No, never use scanf. Use fgets or even fread or read, and sscanf maybe. But then, the numbers conversion by sscanf is not specified in standard anyhow. And using %d, the sscanf does some strange things. %d must read int, but when we read into int and then print that …

Member Avatar for Ajini
0
3K
Member Avatar for ~s.o.s~

C wiki, with a lot of resources [url]http://www.iso-9899.info/wiki[/url]

Member Avatar for mack1
29
5K
Member Avatar for satish_dukkipat

Indeed it seems that the only thing which standard says concerning the unary ++ and -- operators, is that the value of the operand would be obtained for use in expression, either before (postfix) or after (prefix) applying the operator. What remains unspecified is the order of evaluation of the …

Member Avatar for deceptikon
0
224
Member Avatar for pavani2006

Yes vim has these features as well, it is indeed better to use programmers editor instead of ide. If you have makefile, why do you then need all these additional files which IDE makes, like project file, and that's often even not the only one. And all these additional features …

Member Avatar for sujitha77
0
2K
Member Avatar for asilter

So you want a somewhat dynamic array. For really dynamic array you should implement a linked list, which is not very difficult either, but you must be careful because mistakes in implementing it can easily cause a memory leak. But it depends, how are you going to use your array. …

Member Avatar for IcantC
1
180
Member Avatar for bilalb1

I don't know what this "opening a folder" exactly supposed to mean, but one thing which is usually always available, no matter what desktop you use, is xterm. This opens xterm in the directory /pathname/foldername and prints the directory contents: system ("xterm -e 'cd /pathname/foldername && ls && bash'"); Then …

Member Avatar for Ancient Dragon
0
553
Member Avatar for ellenski

I want to say only that, use some more modern compiler than turbo c, like gcc (mingw or cygwin in windows). Turbo c is an extinct compiler, somewhat hopelessly outdated, and you cannot find libraries for it etc. Otherwise, using conio is perfectly ok, there is conio for windows, and …

Member Avatar for kvprajapati
-4
298
Member Avatar for harshchandra

Thank you, good algorithm! The same using GTK, which shows that it's not very difficult to port simple graphics to another graphics library, i don't know though whether i guessed the colors right. [code] #include <gtk/gtk.h> #include <stdlib.h> int diskisin [5], posinpeg [5], diskcount [3], width = 655, height = …

Member Avatar for akhil1989
2
2K
Member Avatar for SOFTHEME

Disgusting, i'm for all programmers to get paid for what their work is worth, not playing with them by taking job from programmers somewhere and giving it to programmers somewhere else. And concerning your government supported IT companies led by communists, i would advise not to have any deal with …

Member Avatar for ehly888
0
246
Member Avatar for TkTkorrovi

You likely want something graphical, where the things move. GTK version of the classic arcade game Asteroids.

Member Avatar for TkTkorrovi
0
139
Member Avatar for TkTkorrovi

A small demo about how to use GTK label as a simple console. To compile GTK program, `pkg-config gtk+-2.0 --cflags --libs` should finally be somewhere in the compiler command line in the bash-like shell.

0
313
Member Avatar for TkTkorrovi

Replaces every occasion of the pattern, or only the first occasion if there is a subexpression, between \( and \), anywhere in the regular expression, as repeated replace is not what one would expect in that case. The string size is restricted in POSIX regular expressions to the size of …

Member Avatar for xaviv
0
1K
Member Avatar for Narue

Thank you for putting up this, it's nice, and certainly much more advanced than mine, though I just wanted to provide a minimal kit which enables to edit files. I have a few questions though, not necessarily about your code, but about such things in general, my code is not …

Member Avatar for Ene Uran
0
146
Member Avatar for TkTkorrovi

A very rudimentary more, press enter to view next screenful of text, like with print command in ed text editor.

0
104
Member Avatar for TkTkorrovi

Similar to cat in unix textutils. You can actually edit files with these. Remember that ctrl-z sends end-of-file in windows, and ctrl-d in linux.

Member Avatar for Dani
0
105
Member Avatar for TkTkorrovi

Text fragment extractor (usage: fragment /pattern/[n] [/pattern/[n]] file), similar to the print command in ed and vi, with pattern range. If the second pattern is omitted, prints to the end of file. Use quotation marks when there are spaces in the argument. Finds the first pattern, then the second pattern, …

0
130
Member Avatar for xponse

Yes it sounds complicated, and any stdafx.h is not a standard c header, either. What is GPP? If you mean gcc, then why it's complicated? Use command line, gcc something.c -o something.exe (in mingw and cygwin) is all you need to compile a standard c program, nothing can be any …

Member Avatar for ~s.o.s~
2
458
Member Avatar for #include_rose

Ancient Dragon is right what concerns scanf. I thus say that in the capacity of the right shouter, like in a meeting someone shouting "that's right", may significantly increase the credibility of the statement made by some other person. Additionally, scanf is a proper function only on condition that no …

Member Avatar for jephthah
0
213
Member Avatar for austinslik

What is the end condition in your for statement? There, your i is 10, you iterate up to the value of some element of your array, which is bigger than the array size. You go beyond the limit of the array, which may cause any kind of unexpected behavior. But, …

Member Avatar for austinslik
0
122
Member Avatar for asilter

I included stdlib.h, and my compiler doesn't give any warning, even with all warnings on. Without stdlib h it says "incompatible implicit declaration of built-in function 'malloc'" gcc 4.1.2, debian linux.

Member Avatar for SphinCorp
0
301
Member Avatar for Dave Sinkula

I think you are good people, i indeed believe that you are good people, and therefore it's natural that you want to believe that world is good, with occasional few bad guys somewhere.

Member Avatar for jwenting
0
517
Member Avatar for TkTkorrovi

I was banned from DaniWeb IRC after jtwenting saying to me that if i were in gulag, i didn't last five minutes when i didn't lick the shoes of the party apparatchic, and after i dared to say anything to defend myself, what i said was only that whether he …

Member Avatar for Serunson
-1
180
Member Avatar for siddharthrainit

I don't know the borland c graphics api and don't recommend to use it, as it's just a commercial library, not standard, not open source and not cross-platform, not very good either. No one agrees with gtk seemingly, but then at least use opengl, or even sdl. But why the …

Member Avatar for Colin Mac
0
165
Member Avatar for zite.1

I only wanted to say, that i don't want to read Narue's posts, as i'm a victim of serious violence by him/her, with which he maybe made it impossible for me to continue here. Just please remember that someone else may be next.

Member Avatar for Narue
0
112
Member Avatar for bhmails

Well it's getchar but getchar is not exactly equivalent to the getche in borland c... By default, the standard input in c is in the canonical mode, which means that all input is line buffered and the line would be received only after the linefeed. This means that no matter …

Member Avatar for TkTkorrovi
0
303
Member Avatar for calipxo

Well we would not start to teach you mathematics here, finally this is a programming forum, you may ask these questions in some mathematics or physics forum. But in short, there are other ways to calculate x^y than to multiply x y times, which is even not possible when y …

Member Avatar for TkTkorrovi
0
112
Member Avatar for manjuannthomas

I may help if i knew how far you actually are. It is not very difficult to write a simple text editor from scratch, first you likely have to implement a doubly linked list of pointers to lines, at least this is how it is implemented in many text editors. …

Member Avatar for TkTkorrovi
0
82
Member Avatar for sInFuL69er

Yes, Salem is right, %c gives you a character with a corresponding code, not a number, 1 1 0 1 0 1 1 1 is exactly what your program outputs when you use %d. Also, when you initialize the arrays, you don't always have to provide the size, like in …

Member Avatar for TkTkorrovi
0
73
Member Avatar for asilter

Load shared library, and call a function in it. Don't use debugger, instead add debug statements to the code, it's much more efficient and faster that way.

Member Avatar for TkTkorrovi
0
80
Member Avatar for asilter

I don't know, maybe it's c++, like there are every kind of weird << and >> in cout... But at least it's not c. Following the typedef identifier should be a declaration, which mostly starts with a type, not with map> something... With typedef you define type, you can use …

Member Avatar for Salem
0
79
Member Avatar for TkTkorrovi

I created this thread to have a common place to discuss these issues. GTK is a cross-platform non-commercial graphical user interface for C, now there are these snippets here using GTK [url]http://www.daniweb.com/code/snippet744.html[/url] and [url]http://www.daniweb.com/code/snippet737.html[/url] but i hope that there would be more :) Maybe the best howto is this [url]http://www.ibiblio.org/apollo/WinGtkHowto.html[/url] …

Member Avatar for TkTkorrovi
0
3K
Member Avatar for amishosh

I wrote this example as a reply to one earlier post about interprocess communication (sockets there provide two-way communication between threads): [code] #include <stdio.h> #include <sys/socket.h> int sv [2]; int main () { socketpair (AF_UNIX, SOCK_STREAM, 0, sv); if (fork ()) { /* parent */ char buf [MAX_INPUT]; char sbuf …

Member Avatar for Ancient Dragon
0
246
Member Avatar for sDJh

There is xsane for windows [url]http://www.xsane.org/xsane-win32.html[/url] free and open source, this can be used separately or together with gimp.

Member Avatar for TkTkorrovi
0
134
Member Avatar for Lost in Code...

It's for some reasons better to compile and run the programs using command line, but if you want to use ide, then you may write something like this in the end: [code] printf ("== press enter ==\n"); getchar (); [/code] Notice that you cannot use any other single character than …

Member Avatar for WaltP
0
197
Member Avatar for NycNessyness

Hehe, the size of this code is already most of my gtk asteroids, this shows how inefficient the code may be...

Member Avatar for Bench
0
125
Member Avatar for the_one

Well then you only believe the authorities -- if you think that the authorities are always right and authority is the only way to establish credibility, then the burden of proof lies on you.

Member Avatar for kb.net
0
154
Member Avatar for Sukhbir

There are function pointers in c, using which you can create structures which a similar to objects in c++, but not all concepts of c++ apply to c.

Member Avatar for SpS
0
133
Member Avatar for mayuning2nd

Please see this thread [url]http://www.daniweb.com/forums/thread86245.html[/url] I have used gtk with mingw quite a lot, but unfortunately not with cygwin. I know though, that there is a cygwin gtk port for windows gui as well, but unfortunately i have not much idea how to find it. The gtk package which you …

Member Avatar for TkTkorrovi
0
167
Member Avatar for qaiser
Re: c

There are no square or cube functions or operators in standard c. There are though functions for logarithms and such. It also depends what precision the result should be, if it has to be a very high precision, you should use some special math library. Please, also, write a bit …

Member Avatar for TkTkorrovi
0
110
Member Avatar for rowly

Yes. As i understand it's something about card game, these calculations are likely used for generating some random numbers. The % operator gives the remainder, so i % 13 always gives a number from 0 to 12, if i is positive, no matter what value i has. The << operator …

Member Avatar for WaltP
0
124
Member Avatar for Prithwish
Member Avatar for iamthwee
0
390
Member Avatar for ashok_169

Download mingw at [url]http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168811236&big_mirror=1[/url] Install it in the directory \mingw. Add \mingw\bin directory to the path, changing start > settings > control panel > system > advanced > environment variables > local variables > PATH. The paths there are separated by semicolon. start > run > cmd, go to your …

Member Avatar for TkTkorrovi
0
119
Member Avatar for quintoncoert

Dunno, try to replace a node with a link to another node... Anything such is difficult though, as when the module loads, it used to create its nodes, so you have to do that always after the modules load, unless you can uninstall some module or somehow configure it... Hope …

Member Avatar for TkTkorrovi
0
127
Member Avatar for AquilesBailo
Member Avatar for asilter

Yes OS supposed to free all the memory allocated by the program when the program exits. But nevertheless, it's a good habbit to free all allocated space when no longer needed, because the program may later be changed in a way that memory would be repeatedly allocated, and the amount …

Member Avatar for Hamrick
0
127
Member Avatar for Firestone

I don't know how to explain it the best... Look, there are variables, which in c terms are really called objects. We can consider these objects as folders, which contain something. Folder has two different properties, it usually has a name, and it has its physical location, somewhere on the …

Member Avatar for VINEET KUMAR
0
181
Member Avatar for ramavundela

Hey, if you so much want something to do... In my GTK Asteroids [url]http://www.daniweb.com/code/snippet744.html[/url] i notice that the enemy bullet sometimeas goes through the ship (i didn't notice any other object to anyhow cross without collision). It's very rare, and harldy ever a big problem in the game, but it …

Member Avatar for TkTkorrovi
0
89
Member Avatar for sainiricha

What do you mean by graphics? If you want to write some games, you should use either opengl for 3d or sdl for 2d (both cross-platform). But if you want edit boxes, menus etc, and 2d graphics also, the best is GTK [url]http://www.gtk.org[/url]. Because it's not commercial like qt, and …

Member Avatar for TkTkorrovi
0
108
Member Avatar for Elfshadow

[QUOTE=Salem;420999] > MINGW The second suggestion is to use a native compiler, not one which has a bloated compatibility layer to make it more Unix-like.[/QUOTE] I see that we can never agree, and i have already an experience that it makes no sense to argue, because there would be no …

Member Avatar for Ancient Dragon
0
276
Member Avatar for b_naren

To control hardware, in general, you have to write a device driver, if of course there is no existing driver for your device, which satisfies your needs. Because the hardware devices cannot be accessed from user space, but only from kernel space. This is the classic book about writing linux …

Member Avatar for TkTkorrovi
0
88

The End.