Posts
 
Reputation
Joined
Last Seen
Ranked #562
Strength to Increase Rep
+5
Strength to Decrease Rep
-1
70% Quality Score
Upvotes Received
9
Posts with Upvotes
7
Upvoting Members
7
Downvotes Received
4
Posts with Downvotes
4
Downvoting Members
2
4 Commented Posts
0 Endorsements
Ranked #914
~33.0K People Reached
Interests
different kind of stuff
PC Specs
dell vostro v131, celeron 867, archlinux openbox
Favorite Forums
Favorite Tags

70 Posted Topics

Member Avatar for alamu

you need to modify only pointer "next", do you know what linked list is? If you know then you can draw something that you whant to do with it and then program this behaviour

Member Avatar for 4rajgopal
0
1K
Member Avatar for ram619

When you subtract two pointers, as long as they point into the same array, the result is the number of elements separating them and in this case each int is 4 byte for example.. then you get this otput on my pc: size of int 4 ptr before changes 2293496 …

Member Avatar for ram619
0
208
Member Avatar for tanatos.daniel

Try otputing to another file instead of windows console and read, as i see you use dos include. Please note that windows new line is not '\n' because it's one byte in linux LF and 2 byte in windows CR+LF please see http://en.wikipedia.org/wiki/Newline

Member Avatar for Sokurenko
0
303
Member Avatar for vipulasri.2007

paste this into your file manager to test c:\\TurboC++\\Disk\\TurboC3\\sample.txt or use sameple.txt and put it in same dir as your exe

Member Avatar for vipulasri.2007
0
686
Member Avatar for saamsonn

are you shure you can use [fgets](http://www.cplusplus.com/reference/clibrary/cstdio/fgets/) ? why dont you use fread for start and try to copy image ? You can also use some hex editor to compare values. **fgets is for text...**

Member Avatar for BobS0327
0
3K
Member Avatar for dancks

if(dist<dr); remove semicolon ? should be or it will do nothing if dist < dr and do nothing on else if(dist<dr) { printf("checkcollision read true\n"); printf("dist: %f, radius+radius: %f\n",dist,dr); goback(0); goback(1); }

Member Avatar for dancks
0
120
Member Avatar for dancks

It looks like it works, please explain better or post file. Also, yes you should take hex editor to know exactly wat you are dealing with.. If it is not 8bit chars then you need to parse it differently.. check out dragon post http://www.daniweb.com/software-development/c/threads/254246/how-to-read-unicode-utf-8-binary-file-line-by-line

Member Avatar for dancks
0
435
Member Avatar for Learningvinit

you reference wrong address, this causes core dump yes ? you add fprintf and maybe initialise some memmory then reference it by mistake, this could be answer m ? check address you reference, and addresses you allocate with memmory

Member Avatar for Learningvinit
0
885
Member Avatar for billionair

this for date ? :) and it should be very portable [Click Here](http://www.cplusplus.com/reference/clibrary/ctime/)

Member Avatar for Ancient Dragon
0
853
Member Avatar for matt.malone.921

you are not the first nor the last who needs to read from file, search google, good luck to you :) http://www.cplusplus.com/reference/clibrary/cstdio/fopen/

Member Avatar for Vish0203
-1
161
Member Avatar for matt.malone.921

can you try this ? or strtol, please say if works while(fscanf(f,"%d",&value) == 1) { /* do something with the value */ }

Member Avatar for Sokurenko
0
98
Member Avatar for shkr

maybe you can use this http://www.cplusplus.com/reference/clibrary/cstdlib/strtol/ #include <stdlib.h> int main() { char *pEnd; printf("%ld\n",strtol("A",&pEnd,16)); return 0; }

Member Avatar for Sokurenko
0
297
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> #include <string.h> #define HOW_MANY_STRUCTS 20 #define MAX_NAME_LENGTH 30 typedef struct ritnish { int iRoll; char pcName[MAX_NAME_LENGTH]; }stRitnish; int main() { stRitnish s[HOW_MANY_STRUCTS] = {0}; srand(time(NULL)); memcpy(s[0].pcName, "TestName!",sizeof("TestName!")); s[0].iRoll = rand() % 1000; printf("Printing name [%s] and number %d\n", s[0].pcName, s[0].iRoll); return 0; } > ok waltp …

Member Avatar for Schol-R-LEA
0
123
Member Avatar for shkr
Member Avatar for kodeeswari

this i wrote for linux what is your platform ? my ubuntu - gcc #include <time.h> #include <stdio.h> int main() { time_t startSeconds; startSeconds = time(NULL); while(1) { system("clear");//platform specific check your platform this is linux/unix printf("%ld \n", time(NULL) - startSeconds); sleep(1);//platform specific check your platform and change this is …

Member Avatar for Sokurenko
0
105
Member Avatar for manishanibhwani

float is 8 bytes and int 4 bytes if you say %f you expect 8 bytes and type float #include <stdio.h> int main() { int iInt = 1; printf("int %d float %f",iInt, (float)iInt); return 0; } btw i suggest you read char buffer in and then convert it to float …

Member Avatar for deceptikon
0
181
Member Avatar for rithish

use this http://www.daniweb.com/software-development/c/threads/429412/string-in-matrices

Member Avatar for rithish
0
2K
Member Avatar for shanki himanshu

this is what it means fifth is null terminator 065 in oct is '5' check ascii table #include <stdio.h> int main() { char str[]="S\065AB"; char strSame[5] = { 'S','\065', 'A', 'B', '\0'}; printf("str 1 %d \n", sizeof(str)); printf("str 2 %d\n", sizeof(strSame)); printf("same ? %d [%s] [%s]",strcmp(str, strSame),str, strSame); return 0; …

Member Avatar for Banfa
0
554
Member Avatar for vijayabhaskar.chowdary

[Arguments to main click](http://publications.gbdirect.co.uk/c_book/chapter10/arguments_to_main.html)

Member Avatar for WaltP
-1
91
Member Avatar for rithish

or something like that #include <stdio.h> #include <stdlib.h> #include <string.h> char *safe_gets(char *buf, size_t size) { if (!fgets(buf, size, stdin)) return NULL; buf[strcspn(buf, "\n")] = '\0'; return buf; } int main(void) { char str[7] = {0}; int i, k = 0; int iLen = 0; printf("Enter string 1: "); fflush(stdout); …

Member Avatar for Sokurenko
0
229
Member Avatar for Member #957352

take a look at this [Click Here](http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence)

Member Avatar for Member #957352
0
205
Member Avatar for shanki himanshu

int a[]={1,2,3,4,5,6,7,8,9,10}; You allocate memmory on stack here and a points to that memmory. Then pointer b points to that memmory location b=a i mean now b and a point to same location so you can work with it same as with a here you can try to print it's …

Member Avatar for shanki himanshu
0
101
Member Avatar for Member #957352

here is good link i found on google [Click Here](http://www.daniweb.com/software-development/c/threads/50370/starting-c-)

Member Avatar for Member #957352
0
111
Member Avatar for on93

Actually all you need is to call function bigger 3 times in printbiggest. If input parameters x i z j bot you will need extra parameter inside function iMax first you get to know x and y biggest then save it and compare it to z then save it and …

Member Avatar for on93
0
132
Member Avatar for Skrell

use printf("size of char %d size of int %d",sizeof(char),sizeof(int)); bot pointer is always 4 byte no ? maybe you can try to cast to char ? by the way where is problem? strcpy(*rowptr,"d"); strcpy(*(rowptr+1),"c++"); printf("ROWPTR+1[%s]",*(rowptr + 1)); strcpy(*(rowptr+2),"java"); printf("ROWPTR+2[%s]",*(rowptr + 2)); they print correct, no ? please see howto allocate …

Member Avatar for Skrell
0
103
Member Avatar for sparsh610

do you know how to create linked list ? if yes then to reverse you can use this post [Click Here](http://www.daniweb.com/software-development/c/threads/426342/singly-link-list-backward) you just take your list and while you traverse it just move to new in reversed order

Member Avatar for sethlahaul
0
175
Member Avatar for lastbencher

> Is it necessary to free the memory of the node that is deleted? What do you mean deleted then ? In c if you loose pointer to some data it is called memmory leak, cause no automatic garbage collection is implemented in c. In java if all references lost …

Member Avatar for sethlahaul
0
218
Member Avatar for monmondiesel

use this [Click Here](http://stackoverflow.com/questions/1534912/how-to-build-in-release-mode-with-optimizations-in-gcc) ifeq ($(BUILD),debug) # "Debug" build - no optimization, and debugging symbols CFLAGS += -O0 -g else # "Release" build - optimization, and no debug symbols CFLAGS += -O2 -s -DNDEBUG endif all: foo debug: make "BUILD=debug" foo: foo.o # The rest of the makefile comes here...

Member Avatar for Sokurenko
0
1K
Member Avatar for jesskavidja

should it work same as strtok ? try not to use malloc and use array index instead of pointer arithmetic then when it works you can try pointer arithmetic(just increment address instead of index) and malloc Make working code and convert would be more easy maybe :)

Member Avatar for Sokurenko
0
294
Member Avatar for sparsh610

Maybe it is [stack](http://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29#Linked_list) ? you push new to first and then pop from first till last ? :) that will be reverse

Member Avatar for mike_2000_17
0
853
Member Avatar for ashish karna

[Operator precendece](http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence) maybe this will help [Click Here too](http://stackoverflow.com/questions/4017954/expression-evaluation-in-c-c-doesnt-follow-bodmas-rule)

Member Avatar for Sokurenko
-1
135
Member Avatar for jemz

i like visual studio at work cause it's easy to navigate big project, bot at home i usually use vim, gedit maybe kate. I use notepad++ too sometimes at work, it's great.

Member Avatar for Lucaci Andrew
0
323
Member Avatar for summer_21

Would be interesting to see example of what you are doing :) I dont understand how to do it, just use bitwise logic operators and if else ? I remember from school we had special graphical program where you can move and connect all that stuff to simulate this.

Member Avatar for dheaven
0
795
Member Avatar for firdousahmad

There are many ways to do this. What about the idea to use linked list and insert new names in correct place every time it is entered? Or even better would be binary tree. Or use some array of pointers to swap pointer values instead of struct values you can …

Member Avatar for abrarsyed
0
806
Member Avatar for pooh1234qwerty

alternative is [malloc](http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/) you will locate it on heap instead of stack or calloc effect is same bot you haveto free it after and it can be dinamically changed during execution :)

Member Avatar for pooh1234qwerty
0
190
Member Avatar for carrot_123

See, if it confuses you so much then maybe separate calculation and printing, and print result variable only. Also can write function to calculate

Member Avatar for TrustyTony
0
3K
Member Avatar for Bencz

Most simple solution if you know max line length and max text length would be using [fgetline](http://www.cplusplus.com/reference/clibrary/cstdio/fgets/) then compare what you got to desired if it is it read next line data. with the same thing [fgetline](http://www.cplusplus.com/reference/clibrary/cstdio/fgets/) or [fread](http://www.cplusplus.com/reference/clibrary/cstdio/fread/) bot then you haveto parse chunks which would be more harder …

Member Avatar for Schol-R-LEA
0
200
Member Avatar for abrarsyed

yes qsort is good example as deceptikon told. Bot it is not possible to pass only array or struct, you need to tell to a function howto compare those values. For example in qsort for struct it could be a.data > b.data

Member Avatar for KenJackson
0
140
Member Avatar for spetro3387

enum or define of possible values and switch no ? #include <stdio.h> enum eGprsEnum { GPRS_T = 3, GPRS_X = 1000, }; int iDoStuff(int iId) { int iRet = 0; switch(iId) { case GPRS_T: printf("%d",iId); break; case GPRS_X: break; default: iRet = -1; break; } return iRet; } int main() …

Member Avatar for L7Sqr
0
99
Member Avatar for kandarpa

@hanananah also will work for original poster you guys better use this one [strtok](http://www.cplusplus.com/reference/clibrary/cstring/strtok/) or if you know pointers good, you can locate it '|' with [strchr](http://www.cplusplus.com/reference/clibrary/cstring/strchr/) if you have only one of these, if you have more you can ofcourse make it work too. Or do it manually, going …

Member Avatar for deceptikon
0
273
Member Avatar for CharlieBrook

use getchar instead of fgets [Click Here](http://www.cplusplus.com/reference/clibrary/cstdio/getchar/) your face is 2 bytes, you read 3 in it

Member Avatar for Ancient Dragon
0
241
Member Avatar for shiushiu

The moust simple way is that you can have max like 300 accounts(300 structs) and 100 users(structs) 2 banks structs then you link them somehow together this does not need to be effective way, cause data is very small. See for example to be easy you can store 3 account …

Member Avatar for Schol-R-LEA
0
155
Member Avatar for abrarsyed

Another possible solution #include <stdio.h> #include <stdlib.h> #include <string.h> void vPassByValue(const void * const vData, int iSizeOfData) { void *vCopyData = NULL; vCopyData = malloc(iSizeOfData); if(vCopyData != NULL) { memcpy(vCopyData, vData, iSizeOfData); printf("passed by value %s\n",vCopyData); memset(vCopyData, 0, iSizeOfData); } free(vCopyData); return; } int main() { char pcBuffer[20] = {0}; …

Member Avatar for Trentacle
0
230
Member Avatar for softnewdevel1

if it is binary value stored then you can read first 8 bytes in float variable and second 8 bytes in float variable i just dont see where you open different files or i dont understand

Member Avatar for Sokurenko
0
123
Member Avatar for lotusdream

dont use sizeof. do track memmory manually or use static buffers for now, and if everything works, try to change them

Member Avatar for Schol-R-LEA
0
395
Member Avatar for bgraw
Member Avatar for bakabozza
0
220
Member Avatar for Perry31

look at [Ascii table](http://www.asciitable.com/) all i whant to say that char is not int, it is one byte - 8 bites combination #include <stdio.h> int main() { /*unsigned*/ char ucChar = 171; int iBit = 7; while(iBit >= 0) { printf("%d", (ucChar &(1 << iBit)) ? 1 : 0 ); …

Member Avatar for WaltP
0
261
Member Avatar for vivekgupta143

dont know, maybe you can play with this code i wrote using printf and figure it out, it will be fun #include <stdlib.h> #include <stdio.h> #include <string.h> int main() { int * piInteger = NULL; int iInteger = 0; void *vPointer = NULL; char *pcBuffer = {"xyz"};//3 bytes and null …

Member Avatar for deceptikon
0
100
Member Avatar for Member #920939

[Why you shouldn't use Dev-C++](http://www.jasonbadams.net/20081218/why-you-shouldnt-use-dev-c/)

Member Avatar for Member #920939
0
2K
Member Avatar for daffi_gusti

i recommend you use [fgetc](http://www.cplusplus.com/reference/clibrary/cstdio/fgetc/) if you do not know max len of line and dont want to concatenate using fread also look at [atoi](http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/)

Member Avatar for Sokurenko
0
4K

The End.