Oh, duh! Thank you.
Type: Posts; User: Explicit
Oh, duh! Thank you.
disk_file = fopen("a:\\may.inv", "rb");
if (!disk_file)
{
printf("No Database...
I'm using the floppy drive to store some random access data...
But when i try to run the program, and open in "rb" mode, and there is no file on the disk, I want the program to tell you to create...
Sweet, thanks so much. I always forget to put the argument variable types in... And the [] for arrays...
struct inventory {
char desc[25];
int prodID;
int prodAmt;
float prodPrice;
};
struct transaction {
char desc[25];
int prodID;
Oh, this is up at the top aswell:
FILE * disk_file;
Also, invDB is an array of a struct.
The compiler gives me an error:
void openInv(struct inventory invDB)
{
disk_file = fopen("a:\\may.inv", "rb+");
if (!disk_file) {
printf("Error: Disk\n");
exit(1);...
Hmm this works aswell:
void invSort(struct inv items[NUM])
{
int inner, outer;
struct inv temp;
int didSwap;
for (outer = (NUM -1); outer >= 0; outer--) {
Umm, nope, it's this one...
http://www.amazon.com/exec/obidos/tg/detail/-/0672305224/qid=1085682922/sr=1-1/ref=sr_1_1/104-1614243-7471922?v=glance&s=books
I also have this one, but it's quite...
Gah, this book is upsetting me. That code is almost exact, word for word from the book. I don't understand why it would be wrong!
Okay, I'm back again. From what I understand this bubble sort, should sort the entire struct in ascending order according to the price member... But it just prints out the struct in its original form...
Ummm, why would you want to do this? So you can set other peoples passwords to nothing when you run the program from a floppy?
Cool. Thanks for the help!
It's kindof odd though, that source isn't much different than the source from the book I'm learning from. I have char strings ints and floats in my struct, but they only...
Hello, I'm having problems learning about rand access files...
Most of my code works, all until you get to the fseek. The output is all garbaled, I'm not sure why.
I'll post the entire code, so...
Actually, your password entry code is more like what I'm looking for than mine is! In mine, if you press backspace it takes it as a char, heh.
Your code works for me :)
I don't want input without pressing enter - I want everything exactly like how scanf works, but printing * when you type, instead of echoing the char you typed!
That is C++, I havn't even learned all of C yet...
Like say your entering a password to get into this forum, sometimes you might know that you pressed a wrong button, and backspace... With the code above, backspace just shows up as a *...
I would like to have a password field similar to scanf but without echoing what you typed in... So you can press backspace and redo a character if you know you messed up:
The best I have so far is...