Forum: Geeks' Lounge 7 Hours Ago |
| Replies: 16 Views: 393 You are worthy of more than one. There! |
Forum: Shell Scripting 8 Hours Ago |
| Replies: 3 Views: 86 It makes a difference the quotation scheme.
sed "/$npname.*in/d" parts.txt > parts.tmp |
Forum: Shell Scripting 10 Hours Ago |
| Replies: 2 Views: 67 What's the trouble?
In its simplest form, create another executable script with three lines of text, where each line is the absolute path to those three scripts. |
Forum: C 10 Hours Ago |
| Replies: 8 Views: 90 char *c; is a pointer, again, it doesn't point to any proper memory allocated to it.
while(fgets(c, 600, fin)!=NULL)
Guess what you are trying to do there? Yeap! Trying to write to poor char *c... |
Forum: C 11 Hours Ago |
| Replies: 8 Views: 90 For some, memory management in C, is a curse, nevertheless it is one of the strength of the language.
After allocating memory for it, remove any & in front of those pointers to string like... |
Forum: C 12 Hours Ago |
| Replies: 8 Views: 90 struct REPLY *reply; is a pointer, anything you try to write to it it will produce a segmentation fault, since there's no memory allocated for it. |
Forum: C 22 Hours Ago |
| Replies: 5 Views: 97 shakunni >Anyone know why this is the case?
A function must be called from another function block which could be the main function or one with a lineage to any main function.
Meaning that main()... |
Forum: C 2 Days Ago |
| Replies: 2 Views: 118 To save the transaction you are almost there.
int bal = 0; /* initialize balance to zero */
instead of bal = 0 + credit; replace for bal = bal + credit; or bal += credit; which is a shortcut. |
Forum: C 3 Days Ago |
| Replies: 2 Views: 100 |
Forum: C 7 Days Ago |
| Replies: 4 Views: 133 It was intended to be a hint, rather that a question to answer. |
Forum: C 7 Days Ago |
| Replies: 10 Views: 325 if( line == pattern)
That's a no-no, since line and pattern are strings and you can't compare arrays in that way.
Take a look at the string function strcmp() for that.
However, even if that would... |
Forum: C 7 Days Ago |
| Replies: 4 Views: 133 if (data_size == SIZE_32 ) {
* ( ((int32_t*)(new_node->data)) + index) = (int32_t) index*2 ;
* ( ((int32_t*)(new_node-> data)) + index) = (int32_t) index*3;
}
else {
*... |
Forum: C 7 Days Ago |
| Replies: 6 Views: 195 The controlling expression of a switch shall have integer type.
An array of chars will not do. |
Forum: C 9 Days Ago |
| Replies: 4 Views: 164 It doesn't matter, if she follows your advise she will get a square.
Then you'll learn nothing.
Some clue:
One loop inside another one as previously said.
Outer loop is the number of rows.... |
Forum: C 9 Days Ago |
| Replies: 2 Views: 156 First, you must understand what constitutes a string in C. It is a sequence of chars terminated with a '\0'.
So if I have this:
char fullname[] = "Jiminy Cricket";
and I want to split it into name... |
Forum: C 11 Days Ago |
| Replies: 11 Views: 429 In the C89 standard, an array must be set with a constant. Which would not allowed what you just did.
int cantidad_frases = 0;
printf("Cuantas frases quieres escribir?: ");
scanf("%d",... |
Forum: C 12 Days Ago |
| Replies: 2 Views: 187 fgets( student[count_s].name, sizeof (student[count_s].name), stdin ); |
Forum: C 13 Days Ago |
| Replies: 2 Views: 179 Dear Sir/Madam:
Certainly, you made the right choice to select this forum to ask your C programming questions. Nevertheless, you skipped two important requirements that must accompany YOUR posting... |
Forum: C 13 Days Ago |
| Replies: 7 Views: 317 void swap(int *num1, int *num2)
{
int tempvar1;
tempvar1 = *num1;
*num1 = *num2; /* learn the difference between num1 and *num1 */
*num2 = tempvar1;
} |
Forum: C 14 Days Ago |
| Replies: 9 Views: 284 >If you can't find complete information about I/O in C from google, you're either an idiot or a liar.
Does it have to be so binary? |
Forum: C 14 Days Ago |
| Replies: 11 Views: 429 frases[1][5]; or if you want to complicate it *(*(frases + 1)+ 5) |
Forum: C 14 Days Ago |
| Replies: 9 Views: 284 Google: the response to much and the answer to nothing. |
Forum: C 14 Days Ago |
| Replies: 2 Views: 188 MONTH and MES are arrays of pointers to read-only memory.
The value they are pointing to it can not be modified. It works the same way than if it were single pointers.
char *dia = "Lunes"; /*... |
Forum: C 15 Days Ago |
| Replies: 9 Views: 201 May I impose on you by asking, why clearerr(stdin); is necessary in this particular example? What risks I am not seeing when used without it? Thank you. |
Forum: C 16 Days Ago |
| Replies: 5 Views: 374 Take a look at its prototype. What type does getch() return? |
Forum: C 16 Days Ago |
| Replies: 9 Views: 383 A brief explanation. (http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351) |
Forum: Shell Scripting 16 Days Ago |
| Replies: 3 Views: 398 Your logic for including the matching pattern escapes me, however I can explain it to you.
This '$1 ~/^#/' tells awk to search for any line that in the first field the beginning of the line starts... |
Forum: C 16 Days Ago |
| Replies: 6 Views: 198 Do you know how to open a file and read from it? |
Forum: C 16 Days Ago |
| Replies: 11 Views: 261 No, no arguing here. Just explaining. ;)
Parsing the data and validating it, is what you are missing. Obviously, you understand that the programmer loose control of the program when the user can... |
Forum: C 16 Days Ago |
| Replies: 11 Views: 261 When I posted the last reply from you, available to me was this http://www.daniweb.com/forums/post1026352.html#post102635.
Afterwards, I saw you and Dave were discussing the errors.
It is my... |
Forum: C 16 Days Ago |
| Replies: 6 Views: 198 One step at a time.
Start learning how to assign values to arrays.
Learn how to read a single or group of characters from a file.
After that it is just a matter of parsing what's read and... |
Forum: C 16 Days Ago |
| Replies: 11 Views: 261 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. |
Forum: C 18 Days Ago |
| Replies: 9 Views: 383 Casting the return of dynamic memory allocation functions should not be made a habit of, in C. If the standard header file stdlib.h is included, there's not need of casting and it can avoid subtle... |
Forum: C 20 Days Ago |
| Replies: 5 Views: 260 fgetc() returns an integer as it is prototyped int fgetc ( FILE * stream );
flyballonfly> however I am still getting the seg fault on the same line.
int j,i,temp,numSegs = 0;
FILE... |
Forum: C 21 Days Ago |
| Replies: 13 Views: 370 needhelpe> yes I know that. but how can I make it work?
A loop is needed to continuously repeat the question until the stop signal (3.14) is reached.
If I would want to ask for a digital until... |
Forum: C 21 Days Ago |
| Replies: 13 Views: 370 Can we see what you have done so far? |
Forum: Windows NT / 2000 / XP 22 Days Ago |
| Replies: 2 Views: 161 |
Forum: C 22 Days Ago |
| Replies: 4 Views: 289 atoi() accepts a string as argument. Not a character i as it is in your code, nor a pointer to a char like you give it as in atoi(&i)
Something like:
char twenty_three[] = "23";
int result;
... |
Forum: Shell Scripting 24 Days Ago |
| Replies: 1 Views: 394 sed -e "s/$old_string/$new_string/" file1.txt > file2.txt |
Forum: C 27 Days Ago |
| Replies: 1 Views: 212 Study the C standard function strcat() (http://www.cplusplus.com/reference/clibrary/cstring/strcat/) or its cousin strncat(). Those two functions are designed to concatenate strings.
strcpy() might... |