Struct and binary files...

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 59
Reputation: nelledawg is an unknown quantity at this point 
Solved Threads: 0
nelledawg nelledawg is offline Offline
Junior Poster in Training

Struct and binary files...

 
0
  #1
May 6th, 2008
Okay so I'm pretty sure I've completely destroyed this code. All I'm trying to do is send the user-inputted product info into a binary file to display when the user chooses the report option from the menu. I'm so confused though and I think I really screwed it up.

  1. // ** Prototypes **
  2. void heading(void);
  3. int menu();
  4. void add();
  5. void report();
  6. char getstring(char entry, char prompt[]);
  7. int getint(int min, int max, char prompt[]);
  8. double getreal(double min, double max, char prompt[]);
  9. double total(double quantity, double amount);
  10. double profit(double profit_cost, double profit_price);
  11. void init_costs(double t[], int x);
  12. void show_costs(double t[], int x);
  13. void show(int prodnum, int prodtype, char d[], int prodquan, double cost, double price, double prod_price, double prod_cost, double prod_profit);
  14. int menuerror(int min, int max, char prompt[]);
  15. int prompt(char msg[]);
  16. int quit(void);
  17. void message(char msg[]);
  18. char firstUpper(char *buf);
  19.  
  20. typedef struct Sports
  21. {
  22. int prodnum;
  23. int prodtype;
  24. char prodscrip;
  25. int prodquan;
  26. double cost;
  27. double price;
  28. } Sports;
  29.  
  30. /* ================================================================ */
  31.  
  32. // ** Functions **
  33.  
  34. int main()
  35. {
  36.  
  37. int TRUE = 1;
  38. int FALSE = 0;
  39. int select, end = TRUE;
  40.  
  41. do
  42. {
  43.  
  44.  
  45. select = menu();
  46. switch (select)
  47. {
  48. case 1: add(); break;
  49. case 2: report(); break;
  50. case 3:
  51. case 4:
  52. case 5: end = quit(); break;
  53. default: message("\n\nPlease make a selection between 1 and 5.\a");
  54. }
  55. }
  56.  
  57. while (end);
  58. return 0;
  59. }
  60. /* ================================================================ */
  61.  
  62. int menu()
  63. {
  64. int choice;
  65.  
  66. system("cls");
  67.  
  68. printf("Sierra Sporting Goods\n\n");
  69. printf("1 = Add a record\n");
  70. printf("2 = Report\n");
  71. printf("3 = Delete a record\n");
  72. printf("4 = Change a record\n");
  73. printf("5 = Quit\n\n");
  74. choice = menuerror(1, 5, "Enter your selection");
  75.  
  76. return(choice);
  77. }
  78.  
  79. /* ================================================================ */
  80.  
  81. void heading()
  82. {
  83. system("cls");
  84. printf("Sierra Sporting Goods\n\n\n");
  85. return;
  86. }
  87. /* ================================================================ */
  88.  
  89. void add()
  90. {
  91.  
  92. double cost, price, prod_cost, prod_price, prod_profit;
  93. double MINCOST;
  94. double MAXCOST;
  95. double MINPRICE;
  96. double MAXPRICE;
  97. int prodnum, prodtype, prodquan;
  98. int MINPROD;
  99. int MAXPROD;
  100. int MINTYPE;
  101. int MAXTYPE;
  102. int MINQUAN;
  103. int MAXQUAN;
  104. char prodscrip;
  105. double types[6];
  106. char choice;
  107. char line[1][6];
  108. Sports s;
  109. FILE *fp;
  110.  
  111.  
  112. init_costs(types,6);
  113. fp = fopen("limits.txt", "rt");
  114. if (fp == NULL)
  115. {
  116. printf("File does not exist");
  117. return;
  118. }
  119.  
  120. else
  121. {
  122. fscanf_s(fp, "%d %d %d %d %d %d %lf %lf %lf %lf", &MINPROD, &MAXPROD, &MINTYPE, &MAXTYPE, &MINQUAN, &MAXQUAN, &MINCOST, &MAXCOST, &MINPRICE, &MAXPRICE);
  123. fclose(fp);
  124. }
  125.  
  126. fp = fopen("data.dat", "ab");
  127. if (fp == NULL)
  128. {
  129. message("Error opening data file\a");
  130. return;
  131. }
  132.  
  133.  
  134. do
  135. {
  136. heading();
  137. s.prodnum = getint(MINPROD, MAXPROD, "product number");
  138. s.prodtype = getint(MINTYPE, MAXTYPE, "product type");
  139.  
  140. s.prodscrip = getstring(prodscrip, "Enter the product description: ");
  141. s.prodscrip = firstUpper(&prodscrip);
  142.  
  143. s.prodquan = getint(MINQUAN, MAXQUAN, "product quantity");
  144. s.cost = getreal(MINCOST, MAXCOST, "product cost");
  145. s.price = getreal(MINPRICE, MAXPRICE, "product price");
  146. prod_cost = total(prodquan, cost);
  147. prod_price = total(prodquan, price);
  148. prod_profit = profit(prod_price, prod_cost);
  149.  
  150. types[prodtype] += prod_cost;
  151.  
  152. show(prodnum, prodtype, prodscrip, prodquan, cost, price, prod_price, prod_cost, prod_profit);
  153. choice = prompt("Would you like to enter another product");
  154. }
  155. while (choice != 'N');
  156. getchar();
  157. show_costs(types,6);
  158.  
  159.  
  160. return;
  161. }
  162. /* ================================================================ */
  163. char firstUpper(char *buf)
  164. {
  165. while (*buf) // Continue as long as characters available.
  166. {
  167. while( isspace(*buf) || !isalpha(*buf) )
  168. *buf++; // Skip all spaces until next character.
  169. *buf = toupper(*buf); // Capitalize first character after space.
  170. while(*buf && !isspace(*buf) )
  171. *buf++; // Skip all characters until next space.
  172. }
  173. }
  174.  
  175. /* ================================================================ */
  176.  
  177. int getint(int min, int max, char item[])
  178. {
  179. int x;
  180. printf("Enter the %s between %d and %d: ", item, min, max);
  181. scanf("%d%*c", &x);
  182. while (x < min || x > max)
  183. {
  184. message("\nError in range. Press Enter to continue.\a");
  185. printf("Enter the %s between %d and %d: ", item, min, max);
  186. scanf("%d%*c", &x);
  187. }
  188. return(x);
  189. }
  190. /* ================================================================ */
  191.  
  192. double getreal(double min, double max, char item[])
  193. {
  194. double y;
  195.  
  196. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  197. scanf("%lf%*c", &y);
  198. while (y < min || y > max)
  199. {
  200. message("\nError in range. Press Enter to continue.\a");
  201. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  202. scanf("%lf%*c", &y);
  203. }
  204. return(y);
  205. }
  206. /* ================================================================ */
  207.  
  208. double total(double quantity, double amount)
  209. {
  210. return (quantity * amount);
  211. }
  212. /* ================================================================ */
  213.  
  214. double profit(double profit_price, double profit_cost)
  215. {
  216. return (profit_price - profit_cost);
  217. }
  218. /* ================================================================ */
  219.  
  220. void init_costs(double *t, int x)
  221. {
  222. int z;
  223.  
  224. for (z = 1; z < x; z++)
  225. *(t + z) = 0;
  226.  
  227. }
  228. /* ================================================================ */
  229.  
  230. void show_costs(double *t, int x)
  231. {
  232. int z;
  233. double total = 0;
  234.  
  235. system("cls");
  236.  
  237. printf(" Product Cost by Type\n\n");
  238. printf("_Type_____________Cost_\n\n");
  239. for (z = 1; z < x; z++)
  240. {
  241. printf(" %2d%20.2lf\n", z, *(t+z));
  242. total += *(t+z);
  243. }
  244. printf("________________________\n");
  245. printf("%23.2lf\n\n\n\n", total);
  246. printf("Press ENTER to return to the Main Menu...");
  247. getchar();
  248.  
  249.  
  250. }
  251. /* ================================================================ */
  252. void message(char *msg)
  253. {
  254. printf("%s\n\n", *msg);
  255. }
  256. /* ================================================================ */
  257.  
  258. int prompt(char *msg)
  259. {
  260. int z;
  261. do
  262. {
  263. printf("%s (Y/N)? ", msg);
  264. z = toupper(getchar());
  265. if (z != 'Y' && z != 'N') printf("\nError, please enter Y or N only.\n");
  266. }
  267. while (z != 'Y' && z != 'N');
  268. return(z);
  269. }
  270. /* ================================================================ */
  271.  
  272. int quit()
  273. {
  274. int TRUE = 1;
  275. int FALSE = 0;
  276. int z, end = TRUE;
  277.  
  278. z = prompt("\nEnd program\a");
  279. if (z == 'Y')
  280. {
  281. system("cls");
  282. message("\nSierra Sporting Goods Database closed successfully.");
  283. end = FALSE;
  284. }
  285. return(end);
  286. }
  287. /* ================================================================ */
  288.  
  289. int menuerror(int min, int max, char item[])
  290. {
  291. int z;
  292. printf("%s from %d to %d: ", item, min, max);
  293. scanf("%d%*c", &z);
  294. while (z < min || z > max)
  295. {
  296. message("\nError in range. Press Enter to continue.\a");
  297. printf("%s from %d to %d: ", item, min, max);
  298. scanf("%d%*c", &z);
  299. }
  300. return(z);
  301. }
  302. /* ================================================================ */
  303. void show(int prodnum, int prodtype, char prodscrip, int prodquan, double cost, double price,
  304. double prod_price, double prod_cost, double prod_profit)
  305. {
  306.  
  307. printf("\n\n\nThe product number is ----------> %04d\n", prodnum);
  308. printf("The product type is ------------> %d\n", prodtype);
  309. printf("The product description is -----> %s\n", prodscrip);
  310. printf("The quantity is ----------------> %d\n", prodquan);
  311. printf("The cost is --------------------> $%.2lf\n", cost);
  312. printf("The price is -------------------> $%.2lf\n\n", price);
  313.  
  314. printf("Total product price ----------> $%.2lf\n", prod_price);
  315. printf("Total product cost -----------> $%.2lf\n", prod_cost);
  316. printf("Total product profit ---------> $%.2lf\n\n\n\n", prod_profit);
  317.  
  318. return;
  319. }
  320.  
  321. /* ================================================================ */
  322.  
  323. void report()
  324. {
  325. int data;
  326. FILE *fp;
  327. struct Sports s;
  328. fp = fopen(“data.dat”, “ab”);
  329. while (fread(&s, sizeof(s), 1, fp) != 0)
  330. {
  331. show();
  332. }
  333. fclose(fp);
  334. }
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Struct and binary files...

 
0
  #2
May 6th, 2008
> fp = fopen(“data.dat”, “ab”);
What sort of quotes are these?

> show();
show() expects a lot of parameters.

Next time, post error messages.

Also, when you've got something which does something useful, make a copy of it.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 59
Reputation: nelledawg is an unknown quantity at this point 
Solved Threads: 0
nelledawg nelledawg is offline Offline
Junior Poster in Training

Re: Struct and binary files...

 
0
  #3
May 6th, 2008
I thought

fp = fopen(“data.dat”, “ab”);

was the right way to code it. It's what my teacher wrote in our lecture.

What do you mean when I have something useful make a copy of it? I'm confused... I'm just trying to learn how to do this stuff and my teacher is of absolutely no help whatsoever, not to mention that according to you his syntax isn't even correct! I don't understand that though because at the top of my code I reference another file using the same format and I haven't gotten an error for it.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,996
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 308
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Cenosillicaphobiac

Re: Struct and binary files...

 
0
  #4
May 6th, 2008
Originally Posted by nelledawg View Post
I thought
fp = fopen(“data.dat”, “ab”);

was the right way to code it.
no. it's fp = fopen("data.dat", "ab"); (wrong quotes)
Originally Posted by nelledawg View Post
What do you mean when I have something useful make a copy of it?
He means ALWAYS backup, backup your backups and back them up

Now tell us, what compiler errors your have, or what errors your program output has.

And as Salem said:
Originally Posted by Salem
> show();
show() expects a lot of parameters.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 59
Reputation: nelledawg is an unknown quantity at this point 
Solved Threads: 0
nelledawg nelledawg is offline Offline
Junior Poster in Training

Re: Struct and binary files...

 
0
  #5
May 6th, 2008
Good lord I'm so confused lol. What part of my version was wrong? I'm supposed to use different quotes? Where in the world are they? lol. It's finals week and I'm exhausted heh.

As far as the backups go, I do have a backup, I just wasnt sure if I wanted to go all the way back to it, and even that one was having problems running as well. But I am going to go back to it because I am way too far gone on this one and I need to figure out why the last one isn't working. It's having trouble opening the text file for some reason and I can't figure out why because I added it as a resource. The program runs but when it asks me to enter a selection I choose 1 to add a record and it flashes "file does not exist" really quickly and then does nothing. Hopefully when I fix this the rest will be easier. Here it is:

  1. // ** Prototypes **
  2. void heading(void);
  3. int menu();
  4. int add();
  5. void getstring(char entry[], char prompt[]);
  6. int getint(int min, int max, char prompt[]);
  7. double getreal(double min, double max, char prompt[]);
  8. double total(double quantity, double amount);
  9. double profit(double profit_cost, double profit_price);
  10. void init_costs(double t[], int x);
  11. void show_costs(double t[], int x);
  12. void show(int prodnum, int prodtype, char d[], int prodquan, double cost, double price, double prod_price, double prod_cost, double prod_profit);
  13. int menuerror(int min, int max, char prompt[]);
  14. int prompt(char msg[]);
  15. int quit(void);
  16. void message(char msg[]);
  17. void firstUpper(char *buf);
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <ctype.h>
  22. #include <string.h>
  23. #include "Lab9.h"
  24.  
  25. /* ================================================================== */
  26.  
  27. // ** Functions **
  28.  
  29. int main()
  30.  
  31. {
  32. int TRUE = 1;
  33. int FALSE = 0;
  34. int select, end = TRUE;
  35.  
  36. do
  37. {
  38.  
  39. select = menu();
  40. switch (select)
  41. {
  42. case 1: add(); break;
  43. case 2:
  44. case 3:
  45. case 4:
  46. case 5: end = quit(); break;
  47. default: message("\n\nPlease make a selection between 1 and 5.\a");
  48. }
  49. }
  50.  
  51. while (end);
  52. return 0;
  53. }
  54. /* ================================================================ */
  55.  
  56. int menu()
  57. {
  58. int choice;
  59.  
  60. system("cls");
  61.  
  62. printf("Sierra Sporting Goods\n\n");
  63. printf("1 = Add a record\n");
  64. printf("2 = Report\n");
  65. printf("3 = Delete a record\n");
  66. printf("4 = Change a record\n");
  67. printf("5 = Quit\n\n");
  68. choice = menuerror(1, 5, "Enter your selection");
  69.  
  70. return(choice);
  71. }
  72. /* ================================================================ */
  73.  
  74. void heading()
  75. {
  76. system("cls");
  77. printf("Sierra Sporting Goods\n\n\n");
  78. return;
  79. }
  80. /* ================================================================ */
  81.  
  82. int add()
  83. {
  84. double cost, price, prod_cost, prod_price, prod_profit;
  85. double MINCOST;
  86. double MAXCOST;
  87. double MINPRICE;
  88. double MAXPRICE;
  89. int prodnum, prodtype, prodquan;
  90. int MINPROD;
  91. int MAXPROD;
  92. int MINTYPE;
  93. int MAXTYPE;
  94. int MINQUAN;
  95. int MAXQUAN;
  96. char prodscrip[40];
  97. double types[6];
  98. char choice;
  99. FILE *fp;
  100. char line[1][6];
  101.  
  102. init_costs(types,6);
  103.  
  104. fp = fopen("limits.txt", "rt");
  105. if (fp == NULL)
  106. {
  107. printf("File does not exist");
  108. return 0;
  109. }
  110.  
  111. else
  112. {
  113. fscanf(fp, "%d %d %d %d %d %d %lf %lf %lf %lf", &MINPROD, &MAXPROD, &MINTYPE, &MAXTYPE, &MINQUAN, &MAXQUAN, &MINCOST, &MAXCOST, &MINPRICE, &MAXPRICE);
  114. }
  115. fclose(fp);
  116. do
  117. {
  118. heading();
  119.  
  120. prodnum = getint(MINPROD, MAXPROD, "product number");
  121. prodtype = getint(MINTYPE, MAXTYPE, "product type");
  122.  
  123. printf("Enter the product description: ");
  124. gets(prodscrip);
  125. firstUpper(prodscrip);
  126.  
  127. prodquan = getint(MINQUAN, MAXQUAN, "product quantity");
  128. cost = getreal(MINCOST, MAXCOST, "product cost");
  129. price = getreal(MINPRICE, MAXPRICE, "product price");
  130. prod_cost = total(prodquan, cost);
  131. prod_price = total(prodquan, price);
  132. prod_profit = profit(prod_price, prod_cost);
  133.  
  134. types[prodtype] += prod_cost;
  135.  
  136. show(prodnum, prodtype, prodscrip, prodquan, cost, price, prod_price, prod_cost, prod_profit);
  137. choice = prompt("Would you like to enter another product");
  138. }
  139. while (choice != 'N');
  140. getchar();
  141. show_costs(types,6);
  142.  
  143.  
  144.  
  145.  
  146. return 0;
  147. }
  148. /* ================================================================ */
  149. void firstUpper(char *buf)
  150. {
  151. while (*buf) // Continue as long as characters available.
  152. {
  153. while( isspace(*buf) || !isalpha(*buf) )
  154. *buf++; // Skip all spaces until next character.
  155. *buf = toupper(*buf); // Capitalize first character after space.
  156. while(*buf && !isspace(*buf) )
  157. *buf++; // Skip all characters until next space.
  158. }
  159. }
  160.  
  161. /* ================================================================ */
  162.  
  163. int getint(int min, int max, char item[])
  164. {
  165. int x;
  166. printf("Enter the %s between %d and %d: ", item, min, max);
  167. scanf("%d%*c", &x);
  168. while (x < min || x > max)
  169. {
  170. message("\nError in range. Press Enter to continue.\a");
  171. printf("Enter the %s between %d and %d: ", item, min, max);
  172. scanf("%d%*c", &x);
  173. }
  174. return(x);
  175. }
  176. /* ================================================================ */
  177.  
  178. double getreal(double min, double max, char item[])
  179. {
  180. double y;
  181.  
  182. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  183. scanf("%lf%*c", &y);
  184. while (y < min || y > max)
  185. {
  186. message("\nError in range. Press Enter to continue.\a");
  187. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  188. scanf("%lf%*c", &y);
  189. }
  190. return(y);
  191. }
  192. /* ================================================================ */
  193.  
  194. double total(double quantity, double amount)
  195. {
  196. return (quantity * amount);
  197. }
  198. /* ================================================================ */
  199.  
  200. double profit(double profit_price, double profit_cost)
  201. {
  202. return (profit_price - profit_cost);
  203. }
  204. /* ================================================================ */
  205.  
  206. void init_costs(double *t, int x)
  207. {
  208. int z;
  209.  
  210. for (z = 1; z < x; z++)
  211. *(t + z) = 0;
  212.  
  213. }
  214. /* ================================================================ */
  215.  
  216. void show_costs(double *t, int x)
  217. {
  218. int z;
  219. double total = 0;
  220.  
  221. system("cls");
  222.  
  223. printf(" Product Cost by Type\n\n");
  224. printf("_Type_____________Cost_\n\n");
  225. for (z = 1; z < x; z++)
  226. {
  227. printf(" %2d%20.2lf\n", z, *(t+z));
  228. total += *(t+z);
  229. }
  230. printf("________________________\n");
  231. printf("%23.2lf\n\n\n\n", total);
  232. printf("Press ENTER to return to the Main Menu...");
  233. getchar();
  234.  
  235.  
  236. }
  237. /* ================================================================ */
  238. void message(char *msg)
  239. {
  240. printf("%s\n\n", *msg);
  241. }
  242. /* ================================================================ */
  243.  
  244. int prompt(char *msg)
  245. {
  246. int z;
  247. do
  248. {
  249. printf("%s (Y/N)? ", msg);
  250. z = toupper(getchar());
  251. if (z != 'Y' && z != 'N') printf("\nError, please enter Y or N only.\n");
  252. }
  253. while (z != 'Y' && z != 'N');
  254. return(z);
  255. }
  256. /* ================================================================ */
  257.  
  258. int quit()
  259. {
  260. int TRUE = 1;
  261. int FALSE = 0;
  262. int z, end = TRUE;
  263.  
  264. z = prompt("\nEnd program\a");
  265. if (z == 'Y')
  266. {
  267. system("cls");
  268. message("\nSierra Sporting Goods Database closed successfully.");
  269. end = FALSE;
  270. }
  271. return(end);
  272. }
  273. /* ================================================================ */
  274.  
  275. int menuerror(int min, int max, char item[])
  276. {
  277. int z;
  278. printf("%s from %d to %d: ", item, min, max);
  279. scanf("%d%*c", &z);
  280. while (z < min || z > max)
  281. {
  282. message("\nError in range. Press Enter to continue.\a");
  283. printf("%s from %d to %d: ", item, min, max);
  284. scanf("%d%*c", &z);
  285. }
  286. return(z);
  287. }
  288. /* ================================================================ */
  289. void show(int prodnum, int prodtype, char prodscrip[], int prodquan, double cost, double price,
  290. double prod_price, double prod_cost, double prod_profit)
  291. {
  292.  
  293. printf("\n\n\nThe product number is ----------> %04d\n", prodnum);
  294. printf("The product type is ------------> %d\n", prodtype);
  295. printf("The product description is -----> %s\n", prodscrip);
  296. printf("The quantity is ----------------> %d\n", prodquan);
  297. printf("The cost is --------------------> $%.2lf\n", cost);
  298. printf("The price is -------------------> $%.2lf\n\n", price);
  299.  
  300. printf("Total product price ----------> $%.2lf\n", prod_price);
  301. printf("Total product cost -----------> $%.2lf\n", prod_cost);
  302. printf("Total product profit ---------> $%.2lf\n\n\n\n", prod_profit);
  303.  
  304. return;
  305. }
  306. /* ================================================================ */
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 59
Reputation: nelledawg is an unknown quantity at this point 
Solved Threads: 0
nelledawg nelledawg is offline Offline
Junior Poster in Training

Re: Struct and binary files...

 
0
  #6
May 6th, 2008
Alright the limits file wasn't working because it got moved out of the lab folder. so now this whole code works and I just need to use a structure and binary record to make the report() function.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 59
Reputation: nelledawg is an unknown quantity at this point 
Solved Threads: 0
nelledawg nelledawg is offline Offline
Junior Poster in Training

Re: Struct and binary files...

 
0
  #7
May 6th, 2008
Alright so it looks like I'm still getting an error... When I select 5 to quit and it asks if I'm sure, if I type "Y" it breaks and I get a window that says "Unhandled exception at 0x1029984f (msvcr90d.dll) in lab 10 FIX.exe: 0xC0000005: Access violation reading location 0x0000000a.

It then opens the output file and goes to line 1624 which says "while (i-- && *p)".

What am I doing wrong??
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 981
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 210
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: Struct and binary files...

 
0
  #8
May 6th, 2008
Originally Posted by nelledawg View Post
When I select 5 to quit and it asks if I'm sure, if I type "Y" it breaks and I get a window that says "Unhandled exception at 0x1029984f (msvcr90d.dll) in lab 10 FIX.exe: 0xC0000005: Access violation reading location 0x0000000a.
Change your message() function to following
  1. void message(char *msg)
  2. {
  3. printf("%s\n\n", msg); // <- asterisk preceding msg now removed
  4. }
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 59
Reputation: nelledawg is an unknown quantity at this point 
Solved Threads: 0
nelledawg nelledawg is offline Offline
Junior Poster in Training

Re: Struct and binary files...

 
0
  #9
May 6th, 2008
Oh wow awesome, thanks!

So now I am starting with fresh code (or rather the error-free code from my previous lab). Now I am editing this lab using struct and binary record to accept the user-inputted data and display it as a report when the user selects report from the menu.

The only problems I'm having now are storing the prodscrip in the binary file after it runs through the firstUpper() function, and getting the report to display.

BTW, there is a limits file included and it looks like this:

1 9999
1 5
1 50
5.00 900.00
6.00 1000.00

Here is the code:

  1. // ** Prototypes **
  2. void heading(void);
  3. int menu();
  4. int add();
  5. void report();
  6. void getstring(char entry[], char prompt[]);
  7. int getint(int min, int max, char prompt[]);
  8. double getreal(double min, double max, char prompt[]);
  9. double total(double quantity, double amount);
  10. double profit(double profit_cost, double profit_price);
  11. void init_costs(double t[], int x);
  12. void show_costs(double t[], int x);
  13. void show(int prodnum, int prodtype, char d[], int prodquan, double cost, double price, double prod_price, double prod_cost, double prod_profit);
  14. int menuerror(int min, int max, char prompt[]);
  15. int prompt(char msg[]);
  16. int quit(void);
  17. void message(char msg[]);
  18. void firstUpper(char *buf);
  19.  
  20. struct sports
  21. {
  22. int prodnum;
  23. int prodtype;
  24. char prodscrip;
  25. int prodquan;
  26. double cost;
  27. double price;
  28. };
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32. #include <ctype.h>
  33. #include <string.h>
  34. #include "10 final.h"
  35.  
  36. /* ================================================================== */
  37.  
  38. // ** Functions **
  39.  
  40. int main()
  41.  
  42. {
  43. int TRUE = 1;
  44. int FALSE = 0;
  45. int select, end = TRUE;
  46.  
  47.  
  48. do
  49. {
  50.  
  51. select = menu();
  52. switch (select)
  53. {
  54. case 1: add(); break;
  55. case 2: report(); break;
  56. case 3:
  57. case 4:
  58. case 5: end = quit(); break;
  59. default: message("\n\nPlease make a selection between 1 and 5.\a");
  60. }
  61. }
  62.  
  63. while (end);
  64. return 0;
  65. }
  66. /* ================================================================ */
  67.  
  68. int menu()
  69. {
  70. int choice;
  71.  
  72. system("cls");
  73.  
  74. printf("Sierra Sporting Goods\n\n");
  75. printf("1 = Add a record\n");
  76. printf("2 = Report\n");
  77. printf("3 = Delete a record\n");
  78. printf("4 = Change a record\n");
  79. printf("5 = Quit\n\n");
  80. choice = menuerror(1, 5, "Enter your selection");
  81.  
  82. return(choice);
  83. }
  84. /* ================================================================ */
  85.  
  86. void heading()
  87. {
  88. system("cls");
  89. printf("Sierra Sporting Goods\n\n\n");
  90. return;
  91. }
  92. /* ================================================================ */
  93.  
  94. int add()
  95. {
  96. double cost, price, prod_cost, prod_price, prod_profit;
  97. double MINCOST;
  98. double MAXCOST;
  99. double MINPRICE;
  100. double MAXPRICE;
  101. int prodnum, prodtype, prodquan;
  102. int MINPROD;
  103. int MAXPROD;
  104. int MINTYPE;
  105. int MAXTYPE;
  106. int MINQUAN;
  107. int MAXQUAN;
  108. char prodscrip[40];
  109. double types[6];
  110. char choice;
  111. FILE *fp;
  112. FILE *f;
  113. char line[1][6];
  114. init_costs(types,6);
  115. struct sports s;
  116.  
  117.  
  118. fp = fopen("limits.txt", "rt");
  119.  
  120. if (fp == NULL)
  121. {
  122. printf("File does not exist");
  123. return 0;
  124. }
  125.  
  126. else
  127. {
  128. fscanf(fp, "%d %d %d %d %d %d %lf %lf %lf %lf", &MINPROD, &MAXPROD, &MINTYPE, &MAXTYPE, &MINQUAN, &MAXQUAN, &MINCOST, &MAXCOST, &MINPRICE, &MAXPRICE);
  129. }
  130. fclose(fp);
  131.  
  132.  
  133. f = fopen("data.dat", "ab");
  134. if (f == NULL)
  135. {
  136. message("Error opening data file\a");
  137. return 1;
  138. }
  139.  
  140. do
  141. {
  142. heading();
  143.  
  144. s.prodnum = getint(MINPROD, MAXPROD, "product number");
  145. s.prodtype = getint(MINTYPE, MAXTYPE, "product type");
  146.  
  147. printf("Enter the product description: ");
  148. gets(prodscrip);
  149. firstUpper(prodscrip);
  150.  
  151. s.prodquan = getint(MINQUAN, MAXQUAN, "product quantity");
  152. s.cost = getreal(MINCOST, MAXCOST, "product cost");
  153. s.price = getreal(MINPRICE, MAXPRICE, "product price");
  154. prod_cost = total(s.prodquan, s.cost);
  155. prod_price = total(s.prodquan, s.price);
  156. prod_profit = profit(prod_price, prod_cost);
  157.  
  158. types[s.prodtype] += prod_cost;
  159.  
  160. show(s.prodnum, s.prodtype, prodscrip, s.prodquan, s.cost, s.price, prod_price, prod_cost, prod_profit);
  161.  
  162. choice = prompt("Would you like to enter another product");
  163. }
  164. while (choice != 'N');
  165. getchar();
  166. show_costs(types,6);
  167.  
  168.  
  169.  
  170.  
  171. return 0;
  172. fclose(f);
  173. }
  174.  
  175. /* ================================================================ */
  176. void firstUpper(char *buf)
  177. {
  178. while (*buf) // Continue as long as characters available.
  179. {
  180. while( isspace(*buf) || !isalpha(*buf) )
  181. *buf++; // Skip all spaces until next character.
  182. *buf = toupper(*buf); // Capitalize first character after space.
  183. while(*buf && !isspace(*buf) )
  184. *buf++; // Skip all characters until next space.
  185. }
  186. }
  187.  
  188. /* ================================================================ */
  189.  
  190. int getint(int min, int max, char item[])
  191. {
  192. int x;
  193. printf("Enter the %s between %d and %d: ", item, min, max);
  194. scanf("%d%*c", &x);
  195. while (x < min || x > max)
  196. {
  197. message("\nError in range. Press Enter to continue.\a");
  198. printf("Enter the %s between %d and %d: ", item, min, max);
  199. scanf("%d%*c", &x);
  200. }
  201. return(x);
  202. }
  203. /* ================================================================ */
  204.  
  205. double getreal(double min, double max, char item[])
  206. {
  207. double y;
  208.  
  209. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  210. scanf("%lf%*c", &y);
  211. while (y < min || y > max)
  212. {
  213. message("\nError in range. Press Enter to continue.\a");
  214. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  215. scanf("%lf%*c", &y);
  216. }
  217. return(y);
  218. }
  219. /* ================================================================ */
  220.  
  221. double total(double quantity, double amount)
  222. {
  223. return (quantity * amount);
  224. }
  225. /* ================================================================ */
  226.  
  227. double profit(double profit_price, double profit_cost)
  228. {
  229. return (profit_price - profit_cost);
  230. }
  231. /* ================================================================ */
  232.  
  233. void init_costs(double *t, int x)
  234. {
  235. int z;
  236.  
  237. for (z = 1; z < x; z++)
  238. *(t + z) = 0;
  239.  
  240. }
  241. /* ================================================================ */
  242.  
  243. void show_costs(double *t, int x)
  244. {
  245. int z;
  246. double total = 0;
  247.  
  248. system("cls");
  249.  
  250. printf(" Product Cost by Type\n\n");
  251. printf("_Type_____________Cost_\n\n");
  252. for (z = 1; z < x; z++)
  253. {
  254. printf(" %2d%20.2lf\n", z, *(t+z));
  255. total += *(t+z);
  256. }
  257. printf("________________________\n");
  258. printf("%23.2lf\n\n\n\n", total);
  259. printf("Press ENTER to return to the Main Menu...");
  260. getchar();
  261.  
  262.  
  263. }
  264. /* ================================================================ */
  265. void message(char *msg)
  266. {
  267. printf("%s\n\n", msg);
  268. }
  269. /* ================================================================ */
  270.  
  271. int prompt(char *msg)
  272. {
  273. int z;
  274. do
  275. {
  276. printf("%s (Y/N)? ", msg);
  277. z = toupper(getchar());
  278. if (z != 'Y' && z != 'N') printf("\nError, please enter Y or N only.\n");
  279. }
  280. while (z != 'Y' && z != 'N');
  281. return(z);
  282. }
  283. /* ================================================================ */
  284.  
  285. int quit()
  286. {
  287. int TRUE = 1;
  288. int FALSE = 0;
  289. int z, end = TRUE;
  290.  
  291. z = prompt("\nEnd program\a");
  292. if (z == 'Y')
  293. {
  294. system("cls");
  295. message("\nSierra Sporting Goods Database closed successfully.");
  296. end = FALSE;
  297. }
  298. return(end);
  299. }
  300. /* ================================================================ */
  301.  
  302. int menuerror(int min, int max, char item[])
  303. {
  304. int z;
  305. printf("%s from %d to %d: ", item, min, max);
  306. scanf("%d%*c", &z);
  307. while (z < min || z > max)
  308. {
  309. message("\nError in range.\a");
  310. printf("%s from %d to %d: ", item, min, max);
  311. scanf("%d%*c", &z);
  312. }
  313. return(z);
  314. }
  315. /* ================================================================ */
  316.  
  317. void show(int prodnum, int prodtype, char prodscrip[], int prodquan, double cost, double price, double prod_price, double prod_cost, double prod_profit)
  318. {
  319.  
  320. printf("\n\n\nThe product number is ----------> %04d\n", prodnum);
  321. printf("The product type is ------------> %d\n", prodtype);
  322. printf("The product description is -----> %s\n", prodscrip);
  323. printf("The quantity is ----------------> %d\n", prodquan);
  324. printf("The cost is --------------------> $%.2lf\n", cost);
  325. printf("The price is -------------------> $%.2lf\n\n", price);
  326.  
  327. printf("Total product price ----------> $%.2lf\n", prod_price);
  328. printf("Total product cost -----------> $%.2lf\n", prod_cost);
  329. printf("Total product profit ---------> $%.2lf\n\n\n\n", prod_profit);
  330.  
  331. return;
  332. }
  333. /* ================================================================ */
  334.  
  335. void report()
  336.  
  337. {
  338. double prod_profit, prod_cost, prod_price;
  339. char prodscrip[40];
  340. FILE *fp;
  341. struct sports s;
  342.  
  343. fp = fopen("data.dat","ab");
  344. while (fread(&s, sizeof(s), 10, fp) != 0)
  345. {
  346. show(s.prodnum, s.prodtype, prodscrip, s.prodquan, s.cost, s.price, prod_cost, prod_price, prod_profit);
  347. }
  348. fclose(fp);
  349. printf("Press ENTER to return to the Main Menu...");
  350. getchar();
  351.  
  352. }
  353. /* ================================================================ */
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 59
Reputation: nelledawg is an unknown quantity at this point 
Solved Threads: 0
nelledawg nelledawg is offline Offline
Junior Poster in Training

Re: Struct and binary files...

 
0
  #10
May 7th, 2008
Alright, worked on it for a while and sort of did the report() function but I don't think it's quite the right way, and none of the values are showing up right.

  1. // ** Prototypes **
  2. void heading(void);
  3. int menu();
  4. int add();
  5. void report();
  6. void getstring(char entry[], char prompt[]);
  7. int getint(int min, int max, char prompt[]);
  8. double getreal(double min, double max, char prompt[]);
  9. double total(double quantity, double amount);
  10. double profit(double profit_cost, double profit_price);
  11. void init_costs(double t[], int x);
  12. void show_costs(double t[], int x);
  13. void show(int prodnum, int prodtype, char d[], int prodquan, double cost, double price, double prod_price, double prod_cost, double prod_profit);
  14. int menuerror(int min, int max, char prompt[]);
  15. int prompt(char msg[]);
  16. int quit(void);
  17. void message(char msg[]);
  18. void firstUpper(char *buf);
  19.  
  20. struct sports
  21. {
  22. int prodnum;
  23. int prodtype;
  24. char prodscrip;
  25. int prodquan;
  26. double cost;
  27. double price;
  28. };
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32. #include <ctype.h>
  33. #include <string.h>
  34. #include "10 final.h"
  35.  
  36. /* ================================================================== */
  37.  
  38. // ** Functions **
  39.  
  40. int main()
  41.  
  42. {
  43. int TRUE = 1;
  44. int FALSE = 0;
  45. int select, end = TRUE;
  46.  
  47.  
  48. do
  49. {
  50.  
  51. select = menu();
  52. switch (select)
  53. {
  54. case 1: add(); break;
  55. case 2: report(); break;
  56. case 3:
  57. case 4:
  58. case 5: end = quit(); break;
  59. default: message("\n\nPlease make a selection between 1 and 5.\a");
  60. }
  61. }
  62.  
  63. while (end);
  64. return 0;
  65. }
  66. /* ================================================================ */
  67.  
  68. int menu()
  69. {
  70. int choice;
  71.  
  72. system("cls");
  73.  
  74. printf("Sierra Sporting Goods\n\n");
  75. printf("1 = Add a record\n");
  76. printf("2 = Report\n");
  77. printf("3 = Delete a record\n");
  78. printf("4 = Change a record\n");
  79. printf("5 = Quit\n\n");
  80. choice = menuerror(1, 5, "Enter your selection");
  81.  
  82. return(choice);
  83. }
  84. /* ================================================================ */
  85.  
  86. void heading()
  87. {
  88. system("cls");
  89. printf("Sierra Sporting Goods\n\n\n");
  90. return;
  91. }
  92. /* ================================================================ */
  93.  
  94. int add()
  95. {
  96. double cost, price, prod_cost, prod_price, prod_profit;
  97. double MINCOST;
  98. double MAXCOST;
  99. double MINPRICE;
  100. double MAXPRICE;
  101. int prodnum, prodtype, prodquan;
  102. int MINPROD;
  103. int MAXPROD;
  104. int MINTYPE;
  105. int MAXTYPE;
  106. int MINQUAN;
  107. int MAXQUAN;
  108. char prodscrip[20];
  109. double types[6];
  110. char choice;
  111. FILE *fp;
  112. FILE *f;
  113. char line[1][6];
  114. init_costs(types,6);
  115. struct sports s;
  116.  
  117.  
  118. fp = fopen("limits.txt", "rt");
  119.  
  120. if (fp == NULL)
  121. {
  122. printf("File does not exist");
  123. return 0;
  124. }
  125.  
  126. else
  127. {
  128. fscanf(fp, "%d %d %d %d %d %d %lf %lf %lf %lf", &MINPROD, &MAXPROD, &MINTYPE, &MAXTYPE, &MINQUAN, &MAXQUAN, &MINCOST, &MAXCOST, &MINPRICE, &MAXPRICE);
  129. }
  130. fclose(fp);
  131.  
  132.  
  133. f = fopen("data.dat", "ab");
  134. if (f == NULL)
  135. {
  136. message("Error opening data file\a");
  137. return 1;
  138. }
  139.  
  140. do
  141. {
  142. heading();
  143.  
  144. s.prodnum = getint(MINPROD, MAXPROD, "product number");
  145. s.prodtype = getint(MINTYPE, MAXTYPE, "product type");
  146.  
  147. printf("Enter the product description: ");
  148. gets(prodscrip);
  149. firstUpper(prodscrip);
  150.  
  151. s.prodquan = getint(MINQUAN, MAXQUAN, "product quantity");
  152. s.cost = getreal(MINCOST, MAXCOST, "product cost");
  153. s.price = getreal(MINPRICE, MAXPRICE, "product price");
  154. prod_cost = total(s.prodquan, s.cost);
  155. prod_price = total(s.prodquan, s.price);
  156. prod_profit = profit(prod_price, prod_cost);
  157.  
  158. types[s.prodtype] += prod_cost;
  159.  
  160. fwrite(&s,sizeof(struct sports),6,fp);
  161.  
  162. show(s.prodnum, s.prodtype, prodscrip, s.prodquan, s.cost, s.price, prod_price, prod_cost, prod_profit);
  163.  
  164. choice = prompt("Would you like to enter another product");
  165. }
  166. while (choice != 'N');
  167. getchar();
  168. show_costs(types,6);
  169.  
  170.  
  171.  
  172.  
  173. return 0;
  174. fclose(f);
  175. }
  176.  
  177. /* ================================================================ */
  178. void firstUpper(char *buf)
  179. {
  180. while (*buf) // Continue as long as characters available.
  181. {
  182. while( isspace(*buf) || !isalpha(*buf) )
  183. *buf++; // Skip all spaces until next character.
  184. *buf = toupper(*buf); // Capitalize first character after space.
  185. while(*buf && !isspace(*buf) )
  186. *buf++; // Skip all characters until next space.
  187. }
  188. }
  189.  
  190. /* ================================================================ */
  191.  
  192. int getint(int min, int max, char item[])
  193. {
  194. int x;
  195. printf("Enter the %s between %d and %d: ", item, min, max);
  196. scanf("%d%*c", &x);
  197. while (x < min || x > max)
  198. {
  199. message("\nError in range. Press Enter to continue.\a");
  200. printf("Enter the %s between %d and %d: ", item, min, max);
  201. scanf("%d%*c", &x);
  202. }
  203. return(x);
  204. }
  205. /* ================================================================ */
  206.  
  207. double getreal(double min, double max, char item[])
  208. {
  209. double y;
  210.  
  211. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  212. scanf("%lf%*c", &y);
  213. while (y < min || y > max)
  214. {
  215. message("\nError in range. Press Enter to continue.\a");
  216. printf("Enter the %s between $%.2lf and $%.2lf: ", item, min, max);
  217. scanf("%lf%*c", &y);
  218. }
  219. return(y);
  220. }
  221. /* ================================================================ */
  222.  
  223. double total(double quantity, double amount)
  224. {
  225. return (quantity * amount);
  226. }
  227. /* ================================================================ */
  228.  
  229. double profit(double profit_price, double profit_cost)
  230. {
  231. return (profit_price - profit_cost);
  232. }
  233. /* ================================================================ */
  234.  
  235. void init_costs(double *t, int x)
  236. {
  237. int z;
  238.  
  239. for (z = 1; z < x; z++)
  240. *(t + z) = 0;
  241.  
  242. }
  243. /* ================================================================ */
  244.  
  245. void show_costs(double *t, int x)
  246. {
  247. int z;
  248. double total = 0;
  249.  
  250. system("cls");
  251.  
  252. printf(" Product Cost by Type\n\n");
  253. printf("_Type_____________Cost_\n\n");
  254. for (z = 1; z < x; z++)
  255. {
  256. printf(" %2d%20.2lf\n", z, *(t+z));
  257. total += *(t+z);
  258. }
  259. printf("________________________\n");
  260. printf("%23.2lf\n\n\n\n", total);
  261. printf("Press ENTER to return to the Main Menu...");
  262. getchar();
  263.  
  264.  
  265. }
  266. /* ================================================================ */
  267. void message(char *msg)
  268. {
  269. printf("%s\n\n", msg);
  270. }
  271. /* ================================================================ */
  272.  
  273. int prompt(char *msg)
  274. {
  275. int z;
  276. do
  277. {
  278. printf("%s (Y/N)? ", msg);
  279. z = toupper(getchar());
  280. if (z != 'Y' && z != 'N') printf("\nError, please enter Y or N only.\n");
  281. }
  282. while (z != 'Y' && z != 'N');
  283. return(z);
  284. }
  285. /* ================================================================ */
  286.  
  287. int quit()
  288. {
  289. int TRUE = 1;
  290. int FALSE = 0;
  291. int z, end = TRUE;
  292.  
  293. z = prompt("\nEnd program\a");
  294. if (z == 'Y')
  295. {
  296. system("cls");
  297. message("\nSierra Sporting Goods Database closed successfully.");
  298. end = FALSE;
  299. }
  300. return(end);
  301. }
  302. /* ================================================================ */
  303.  
  304. int menuerror(int min, int max, char item[])
  305. {
  306. int z;
  307. printf("%s from %d to %d: ", item, min, max);
  308. scanf("%d%*c", &z);
  309. while (z < min || z > max)
  310. {
  311. message("\nError in range.\a");
  312. printf("%s from %d to %d: ", item, min, max);
  313. scanf("%d%*c", &z);
  314. }
  315. return(z);
  316. }
  317. /* ================================================================ */
  318.  
  319. void show(int prodnum, int prodtype, char prodscrip[], int prodquan, double cost, double price, double prod_price, double prod_cost, double prod_profit)
  320. {
  321.  
  322. printf("\n\n\nThe product number is ----------> %04d\n", prodnum);
  323. printf("The product type is ------------> %d\n", prodtype);
  324. printf("The product description is -----> %s\n", prodscrip);
  325. printf("The quantity is ----------------> %d\n", prodquan);
  326. printf("The cost is --------------------> $%.2lf\n", cost);
  327. printf("The price is -------------------> $%.2lf\n\n", price);
  328.  
  329. printf("Total product price ----------> $%.2lf\n", prod_price);
  330. printf("Total product cost -----------> $%.2lf\n", prod_cost);
  331. printf("Total product profit ---------> $%.2lf\n\n\n\n", prod_profit);
  332.  
  333. return;
  334. }
  335. /* ================================================================ */
  336.  
  337. void report()
  338.  
  339. {
  340. double prod_profit = 0, total_profit = 0;
  341. char prodscrip[20];
  342. FILE *fp;
  343. struct sports s;
  344.  
  345.  
  346. system("cls");
  347.  
  348. fp = fopen("data.dat","ab");
  349. if (fp == NULL)
  350. {
  351. printf("File does not exist");
  352. return;
  353. }
  354. else
  355. {
  356. fread(&s, sizeof(s), 10, fp);
  357. printf(" Sierra Sporting Goods\n\n");
  358. printf("__Prod #___Type___Description____________Qty___Cost____Price____Profit__\n\n");
  359.  
  360. prod_profit = (s.price - s.cost) * s.prodquan;
  361. total_profit += prod_profit;
  362.  
  363. printf(" %3d%5d%5s%4d%3.2f%3.2f%3.2f\n", s.prodnum, s.prodtype, prodscrip, s.prodquan, s.cost, s.price, prod_profit);
  364. printf("________________________________________________________________________\n");
  365. printf(" Total Expected Profit%46.2f\n\n\n\n", total_profit);
  366. printf("Press ENTER to return to the Main Menu...");
  367. getchar();
  368. }
  369. fclose(fp);
  370.  
  371. }
  372. /* ================================================================ */
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1026 | Replies: 12
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC