meh, was initalizing it to 'a' cause thats how i got the catalogue array thing to work
the Catalogue Array thingy reads in a string from the kb, and uses it as the file name in the fopens()...
Type: Posts; User: Ubber_C_Noob
meh, was initalizing it to 'a' cause thats how i got the catalogue array thing to work
the Catalogue Array thingy reads in a string from the kb, and uses it as the file name in the fopens()...
hey, just me again:
new segfault and this one aint my fault
char *temp = malloc(sizeof(*temp)*10);
temp[0]='a';
scanf("%9s",temp);
thats it, it segfaults at scanf and i dont know why.
never mind, thanx guys i fixed it, but only with your expert help.
thats fixed the warning, does anyone have any idea how to fix the porblem with the segmenting?
if i try the '&' thing infront of Catalogue in the fopen statement i get
warning: passing arg 1...
hehe, you guys must be really getting tired of my noobishness.
char *Catalogue = malloc(sizeof(*Catalogue)*10);
Catalogue = "a";
printf("What file would you like to load? ");...
hey, quzah and bithub, ever consider tutoring first year uni students?
i tells ya, you'ed be great at it.
i probably should have mentioned this earlier but two of the restraints i have are,
1. Only runtime memory is to be used.
an
2. You have to know what your doing.
im pretty sure the tutors...
im really sorry that you had to type all that cause i understood everything upto
/* sizeof(temp) will typically be 4 on 32 bit systems. You probably want a value of about 19 */
and then you...
what? remember, total programing time < 20 hours, speak slo and use small words please. :p
and wouldnt 599 slots be enough? i would have thought it would.
and anyway, wouldnt that go wrong if i...
ok, you wanted the function ReadCatatlogue here it is:
void ReadCatalogue(FILE *myfile)
{
char*loadedfile=(char*)malloc(sizeof(char*)*600);
char*temp =...
ok heres the new porblem.
char*Catalogue = (char*)malloc(sizeof(char*)*10);
scanf("%s",&Catalogue);
if((myfile = fopen(&Catalogue,"r+"))==NULL)
{
printf("\nFile could not be loaded.\n");...
the above post is no longer valid, ive change the code soo much.
ok, i chagnged it so that you dont get the compare string in the main function, but in the ReadCatalouge function, thus reducing the amount of things being passed to ReadCatalogue.
segementation...
nope soz dude that didnt help at all, still segmenting. :(
i have the following:
myfile=fopen("getlin.txt","r+");
char*compare=(char*)malloc(sizeof(char*)*20);
int*choice=(int*)malloc(sizeof(int*)*2);
scanf("%d",choice);
printf("\nWhat would you...