There are a fair few errors in this from what i can see. You are mainly using the one variable name - that being name[i]
printf("Enter the Name you are Searching for: ", name[i]);
...
Type: Posts; User: Simon
There are a fair few errors in this from what i can see. You are mainly using the one variable name - that being name[i]
printf("Enter the Name you are Searching for: ", name[i]);
...
Thanks Hammer.
Always good.
so let me just summarise:
>>char buf;
needs to be declared because when the compiler sees fgets() it needs to know how big the file is
>>#define BUFSIZ 4028
i'm guessing this isn't necessary
I posted it before but are buff and bufsiz standard variable names, do they have to be used and are they only used to show the size of the file?
In this code
#include <stdio.h>
int main ( ) {
char buff[BUFSIZ];
FILE *fp = fopen( "file.txt", "r" );
if ( fp == NULL ) { /* error */ }
while ( fgets( buff, BUFSIZ, fp )...
The screen, (otherwise known as stdout):D
OK, this should be the end.
So what happens in this:
while ( fgets( buff, BUFSIZ, fp ) != NULL ) {
fputs( buff, stdout );
are you referring to -
http://www.eskimo.com/~scs/C-faq/top.html?
or something else?
while ( fgets( buff, BUFSIZ, fp ) != NULL ) {
fputs( buff, stdout );
could you explain what while ( fgets( buff, BUFSIZ, fp ) != NULL ) is doing, with buff and BIFSIZ, are they standard...
Sorry, but i can't really figure it out,
int n=sizeof(u)/sizeof(int);
Is it really necessary to be using sizeof?
Isn't it just getting the size of the array?
#include <stdio.h>
void sortdescending(int u[], int n);
void sortascending(int u[], int n);
int main(void)
{
int u[]={333,111,444,555,999};
int n=sizeof(u)/sizeof(int);
int k;
int choice;
Gday all,
I'm trying to get all this file processing under control and i am having a bit of trouble.
I think i can create a file ok and store information into it, but i'm not sure if there is a...
Thanks Salem,
Always Very Reliable.
Thanks Salem,
Always Very Reliable.
so instead of this:
which casts malloc as a char*,
you would be better to do this:
t=malloc(26 * sizeof(char));
???
so instead of this:
which casts malloc as a char*,
you would be better to do this:
t=malloc(26 * sizeof(char));
???
Gday,
Just wondering, i have read a fair bit that you shouldn't cast malloc and i am just wondering what casting actually is e.g
from another post
example t=(char*)malloc(26 * sizeof(char));...
Gday,
Just wondering, i have read a fair bit that you shouldn't cast malloc and i am just wondering what casting actually is e.g
from another post
example t=(char*)malloc(26 * sizeof(char));...
thats quite funny
Does anyone know if there is a place that i can get information on how to comment in a program properly? and overall documentation.
Thanks Guys,
Simon
Thanks hammer, you are a qualified champion.:D
Thanks for pointing that out Quzah, it is always the little things. however - same problem
For example if there are 5 records then the last record would be [4] correct? If i want to get rid of the...
Hi, i'm wondering if someone can tell me why this deleting function will not erase the final element in the array
I can delete all others except for the last element
The function is in blue
...
Hey guys, i've been working on this program and finally i am trying to implement a menu.
I've written the code, but now i'm having heaps of problems with things such as returning to the menu, and...
Is there any way i would be able to use strcpy to delete a record and just overwrite the record to be deleted with the last one in the array and then resort?
e.g. strcpy(details[recordtobedeleted]...