1,088 Posted Topics

Member Avatar for theprofoundgeek

[QUOTE=theprofoundgeek;1024008]Yeah, Gaiety, its always preferable to type cast the data type then convert it in every instance of accessing the data. (At least this is what I have been told up to now!)[/QUOTE] Casting the return of dynamic memory allocation functions should not be made a habit of, in C. …

Member Avatar for Gaiety
0
155
Member Avatar for Gerbilkit

[QUOTE=Gerbilkit;1026571] As I said I have no clue what # $1 !~/^#/ { means, I found it on the internet and popped it in since it made lots of syntax errors go away. :P [/QUOTE] Your logic for including the matching pattern escapes me, however I can explain it to …

Member Avatar for Aia
0
115
Member Avatar for Odc

[QUOTE=Odc;1026346] I am trying to read integers from a file and store them into an array but I have no idea how to do it. [...][/QUOTE] One step at a time. Start learning how to assign values to arrays. Learn how to read a single or group of characters from …

Member Avatar for Odc
0
118
Member Avatar for OSiRiSsk

So you think you solved it? Enter... let's say: "H" or better yet "3.s" and tell us back what's the behavior you observed.

Member Avatar for Aia
0
261
Member Avatar for flyballonfly

[QUOTE=Arcaiz;1022276] fgetc returns char type but your array is int type. Maybe that's the problem[/QUOTE] [ICODE] fgetc() [/ICODE]returns an integer as it is prototyped [code=c]int fgetc ( FILE * stream );[/code] flyballonfly> however I am still getting the seg fault on the same line. [CODE]int j,i,temp,[COLOR="Red"]numSegs = 0;[/COLOR] FILE *infile …

Member Avatar for dkalita
0
86
Member Avatar for needhelpe

[QUOTE=needhelpe;1020904]hey I need help. I made one code but doesn't work!!![/QUOTE] Can we see what you have done so far?

Member Avatar for Dave Sinkula
-1
197
Member Avatar for hosh

[QUOTE=hosh;1020069]Hi, can anyone help me to solve this problem? I have this code: FILE *in; char i =fgetc(in); int perm=0; perm =atoi(&i); printf("%d\n", perm); if first character in my "in" file is 2, the output is 28; if ------------------------------- is 3, -------------- 38, and so on... any ideas what is …

Member Avatar for hosh
0
135
Member Avatar for rajenammaan
Member Avatar for OSiRiSsk

[QUOTE=OSiRiSsk;1010927]well but i will read multiple lines, so how to make this code right ?[/QUOTE] Perhaps another approach? [CODE=c]#include <stdio.h> #include <ctype.h> void clean_spaces(void); int main(void) { clean_spaces(); return 0; } /* * clean_spaces will leave only the first space found and it ignores extra * instances */ void clean_spaces(void) …

Member Avatar for OSiRiSsk
0
542
Member Avatar for aumi

Hi, i need some help. i have an assignment on "Airline Ticket Reservations System". i have to submit it on 10th August, 2008. I tried but can't solve it. please help me. The question is given below : 1. Consider a new airline agency “BEST AIR” that launches recently in …

Member Avatar for ithelp
0
322
Member Avatar for ahaZohan

[QUOTE=ahaZohan;1014353]Hi, I have 2 arrays and i want to put them in one array. array1[10]="hello" array2[10]="you" array12[10]="hello you" How can I do this. Many thx![/QUOTE] Study the C standard function [URL="http://www.cplusplus.com/reference/clibrary/cstring/strcat/"]strcat()[/URL] or its cousin strncat(). Those two functions are designed to concatenate strings. strcpy() might be needed to copy the …

Member Avatar for Aia
0
85
Member Avatar for hket89

[QUOTE=hket89;957371]What is the purpose of using call by value and call by reference?[/QUOTE] Your question revealed that perhaps you are not understanding what it has been explained so far. There's not such a thing as call by reference in The C language. Everything done is done by coping values around. …

Member Avatar for BestJewSinceJC
0
176
Member Avatar for geoffy0404

[QUOTE=geoffy0404;1012540]I know my problem is within the SWITCH CASE!![/QUOTE] Plenty of thing are erroneous in your snippet, however I would like to point out the cause of your affliction for now. [CODE]printf(" A - Addition\n S - Subtraction\n M - Multiplication\n D - Division\n Q - Modular\n"); /* use scanf …

Member Avatar for Aia
0
128
Member Avatar for red999

scanf() reads the integer but leaves the `ENTER or RETURN' key you pressed, in the stdin buffer. That key is seen by fgets() as a newline and that's what it reads, not waiting for the user to interact. Inserting a getchar() between scanf() and fgets() does eat that left-over newline, …

Member Avatar for Aia
0
281
Member Avatar for Eko

>I don't understand what's wrong with assigning the value 0.1 to a float variable . There's nothing wrong with it, the compiler is warning you that you are trying to assign a double to a float. A literal 0.1 is a double in your compiler. Do a test. Add these …

Member Avatar for dwayneb
0
5K
Member Avatar for geoffy0404

[CODE=c]#define ADDITION = addition #define SUBTRACTION = subtraction #define MULTIPLICATION = multiplication #define DIVISION = division #define MODULAR = modular [/CODE] Find what's wrong with those

Member Avatar for Gaiety
0
216
Member Avatar for sweetjhin

[QUOTE=sweetjhin;1010850]I'm not actually looking for a quick answer to my homework. That's why I asked this question because I was hoping that I could find a program that would display the whole calendar. Right now the program I made is just displaying one month and I don't know how to …

Member Avatar for sweetjhin
1
110
Member Avatar for Marton

[QUOTE=dkalita;1008793]U can do the same as follows: [CODE] void write(char string[]) { int i; FILE *file; char *strTemp=(char *)malloc(strlen(string)+1); /* * Where would be that pointer be pointing to if malloc is not successful * allocating memory? You must always check for the return of malloc. * casting malloc is …

Member Avatar for dkalita
0
139
Member Avatar for rakeysh verma

[CODE]+--------------------------------------------+ | | X | |--------------------------------------------| | CONGRATULATIONS! | | | | You are the lucky moron of the moment, | | by ignoring forum rules. | | Click OK to claim your price. | | | | +------+ | | | [URL="http://www.daniweb.com/forums/announcement118-2.html"]OK[/URL] | | | +------+ | +--------------------------------------------+[/CODE]

Member Avatar for ajay.krish123
-1
250
Member Avatar for kaku_lala

[QUOTE]The definition of the ‘C’ Library function memset is void *memset(char *s, char c, size_t n) Copy c to the first n characters of s. Return s. [/QUOTE] The proper prototype is [ICODE]void * memset ( void * ptr, int value, size_t num );[/ICODE] [QUOTE]void *memset(char *s, char c, size_t …

Member Avatar for whyname
0
218
Member Avatar for D_switch

Here's an assignment. Search why [CODE]gets(s[i]);[/CODE] is a no no. What is it that you are sorting the names by?

Member Avatar for D_switch
0
5K
Member Avatar for VernonDozier

[QUOTE=VernonDozier;991659]I have a data file that, if I was using C++, I would use the getline function to read its data into the proper variables. However, the getline functions that C++ allows appear to not be available to me in C. I want to be able to specify a stream, …

Member Avatar for VernonDozier
0
243
Member Avatar for chathu12

[CODE]fopen("C:[COLOR="Red"]\d[/COLOR]ata[COLOR="Red"]\d[/COLOR]ef.txt","r")[/CODE] If you don't double it, the compiler is going to try to interpreted as the character \d which is wrong. strtok() is a silly function with limited utility in reality. It looks for the given characters and when it finds a first success, it changes as a NULL. Which …

Member Avatar for dkalita
0
164
Member Avatar for rocky420

[QUOTE=rocky420;985341]Files Infected: C:\WINDOWS\system32\SKYNETlog.dat (Trojan.Agent) -> No action taken.[/QUOTE] SKYNET is used as part of rootkit technology which will be hard to clean unless you understand what's going on. Maybe [URL="http://www.malwarebytes.org/forums/index.php?showtopic=12709"]this thread[/URL] will do just that A solution I find more secure is to boot with [URL="http://www.softpedia.com/get/System/Boot-Manager-Disk/UBCD4WIN.shtml"]UBCD[/URL] and open a terminal. …

Member Avatar for jholland1964
0
161
Member Avatar for priyairani00
Member Avatar for azn_sweet

[QUOTE=azn_sweet;978779][code] /*Output Section */ printf ("\nThat height is equivalent to " "%1f" " feet and " "%2f" " inch(es).\n"); scanf ("%f", &FEET); scanf ("%f", &INCHES); [/code][/QUOTE] This is how you add quotes to the specifiers and those are the correct parameters if you want to control the output of the …

Member Avatar for Aia
0
72
Member Avatar for Techwriter10

>I don't really know where he is coming from. Is it that hard to understand where he's coming from? From a security, privacy and freedom stand point. >That sort of commodity service doesn't sound stupid to me. So much focus it has been shown already to the word stupid. And …

Member Avatar for brucearnold
0
512
Member Avatar for newsguy

>Third world countries don't deserve cutting edge technology. Better to remain silent and be thought a fool than to speak out and remove all doubt.

Member Avatar for slimwasim
0
173
Member Avatar for happygeek

>What's next, defending murder as "freedom of expression"? No need, we have other terminology: "self-defense war"

Member Avatar for Aia
0
250
Member Avatar for Techwriter10

Foxit Reader is a favorite of mine from sometime already. I like the way it opens pdf right away.

Member Avatar for libbylab
0
739
Member Avatar for khess

Much coverage for so little content. That's what I see on all this blogging about Microsoft donating a mere $100.000, which it barely will cover the year-salary of one full time developer. As far as Microsoft goes they got their money worth times over in PR and exposure value.

Member Avatar for khess
0
163
Member Avatar for khess

I wonder if the Open Source community will still be arguing about the name. What's it going to be? Linux/Skynet or GNU/Skynet? In any case you have gave me reason to be worry of April 21, 2011. Just making fun! We all know that the end of The World would …

Member Avatar for Aia
0
147
Member Avatar for EddieC

I can not wait for the day they will open Windows 3.1, which I prefer over Windows 3.0 because the analog clock run much faster.

Member Avatar for EddieC
0
544
Member Avatar for happygeek

>“what’s fair is fair.” Whao!. I would love to get paid as much as he gets just to be able to say these kind of profound statements. I am so moved that I'm thinking of giving him a big hug of support and condolences.

Member Avatar for Sturm
0
530
Member Avatar for Dave Sinkula
Member Avatar for dumbncool

[QUOTE=Dave Sinkula;962553]Perhaps it was just the chart I was looking at the showed postfix at higher precedence than prefix.[/QUOTE] Isn't this another case were we should not depend in the order of precedence between [I]sequence points[/I]?

Member Avatar for Aia
0
150
Member Avatar for DoEds

Passing values on a function is done by making a copy of it, which means the original is not modified. [CODE]int changeBandC(int b,int c) { int changeBandC = 0; /* This is wrong here delete it */ b = b + 1; /*the work is done in b which is …

Member Avatar for Aia
0
117
Member Avatar for pymatio

pymatio> I expected the of output to look like the file, whats wrong? Your understanding of how fscanf() works. pymatio> [CODE]while (fscanf(f, "%s", line) != EOF) { [/CODE] [ICODE]"%s"[/ICODE] won't read a line but rather until encounters an space, blank, tab, newline.

Member Avatar for tux4life
0
303
Member Avatar for EvilOrange

[QUOTE=EvilOrange;956178]there is only 2 var missing and thats: char a; FILE *out; argv[2] is NULL which is why this bit of code comes into play[/QUOTE] [B]On the phone[/B] [B]Nick:[/B] Doctor, can you cure my cough? It is a horrible cough, I cannot sleep at night. [B]Dr. Hell:[/B] Sorry, Nick, I …

Member Avatar for EvilOrange
0
260
Member Avatar for DeathEvil

>there are parts in between that I cut out but are irrelevant because compiler complains only about integer_part variable Make the variables [COLOR=Green]double[/COLOR] instead of [COLOR=Red]floats [/COLOR]and you'll be fine. BTW, main returns an int, so it should be [COLOR=Green]int main( void )[/COLOR] and not [COLOR=Red]void main( void )[/COLOR]

Member Avatar for 42Wired
0
190
Member Avatar for des6043

[CODE]printf("\nyour is grade A",Total);[/CODE] Take a look at that one. Figure what are you missing. When you post code you need to wrapped around code tags to present it in a proper format. [URL="http://www.daniweb.com/forums/thread93280.html"]See here[/URL].

Member Avatar for des6043
0
158
Member Avatar for compubaba

[QUOTE=9868;941173]Dont you think there is no chance in hell that f() will be called g() or h(), coz * has higher precedence than +. If f() is called first than, the whole purpose of precedency is lost.[/QUOTE] Precedence doesn't have any hold on them, since that behavior is undefined.

Member Avatar for Salem
0
168
Member Avatar for riyas_26

[QUOTE=iamthwee;940799]Just make sure you flirt with the interviewer. If it's a guy, tell him that the way he sits turns you on. If it's a girl, say she smells good enough to eat. If they ask about programming just say you don't know anything at the moment because you're a …

Member Avatar for DangerDev
0
176
Member Avatar for no1zson

no1zson> What is wrong with GOTO? It usually is misused and it has the potential of making any code hard to debug and maintain. no1zson> What would you suggest in its place? Ideally, a sharp mind with the ability to design a flow control from top to bottom.

Member Avatar for no1zson
0
329
Member Avatar for samli88

If you take the time to read the rules on how to post and present your question, you might get better results. Start with [URL="http://www.daniweb.com/forums/thread78060.html"]this[/URL] and then go [URL="http://www.daniweb.com/forums/thread93280.html"]here[/URL] For convenience to the desperate and impatient those are shortcuts.

Member Avatar for Aia
0
107
Member Avatar for PetuniaRose

[QUOTE=PetuniaRose;939155]I see folks replying to threads with quotes that have the name of the original poster included - they have the form nameOfPoster> quote [...][/QUOTE] I use that form in conversations when I need to bring focus to a particular portion of the quote. And I use the name from …

Member Avatar for Ancient Dragon
0
120
Member Avatar for no1zson

no1zson> can somebody look at my IF loop (the first one for selcting 1-3) and see where I am going wrong? I am sure we can guess what you are trying to do, but don't you think it would be more effective if you tell us what is supposed to …

Member Avatar for no1zson
0
192
Member Avatar for MrNoob

yellowSnow> If this is the case, then perhaps you should try using the strtok() function. strtok() is a poor designed function, which make this recommendation a poor choice.

Member Avatar for Dream2code
0
231
Member Avatar for EvilOrange

EvilOrange> string[j][0] = string; <-- HERE IS THE PROBLEM string[j][0] is a space to hold a character string, on the other hand, is an array of characters. For sure there's going to be a problem if you try to push a bunch of character where only one can live.

Member Avatar for EvilOrange
0
121
Member Avatar for taikoprogrammer

taikoprogrammer> How do you calculate powers in C If you are referring to especial operator, C doesn't have an operator for power. If you include the math.h file you may make use of the function pow() Otherwise you define a function that calculates the power the same way you would …

Member Avatar for Dave Sinkula
0
157

The End.