LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 07-23-2015, 03:32 AM   #1
NoWeDoR
Member
 
Registered: Jun 2015
Posts: 32

Rep: Reputation: Disabled
An issue with deleting function


It can be deleted.

Last edited by NoWeDoR; 07-23-2015 at 11:21 AM.
 
Old 07-23-2015, 06:43 AM   #2
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 852

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Ok, where do I start?

1/ Why are practically all your variables global? That's not a very good style.
2/ There's a lot of duplicate code in your program. That makes it more difficult to read, maintain and debug.
3/
Code:
static int counter = 0;
Why static?
4/ main does not return anything.
5/
Code:
struct personKnowledge *p;   // p = (Person)
p = (struct personKnowledge *)malloc(sizeof(struct personKnowledge));
Why the dynamic allocation?

6/
Code:
fwrite(&(*p), recordLength, 1, ptrFILE);
&(*p) is just p.

7/
Code:
number = -791673918435;
Err... what?

8/
Code:
	for (i = 1; i <= totalRecordNumber; i++)
	{
		if (i == number)
		{
			Sleep(350);
			printf("The record has been cleared.\n");
			continue;
		}
		else
		{
			fwrite(&(*del), recordLength, 1, ptrFILE1);
		}
	}
This just writes the first record of the original file n-1 times into the new file.
 
Old 07-23-2015, 02:48 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
@NoWeDoR:

Hi,

Welcome to LQ.

Please review the Welcome to LQ thread for some help in asking your question better.

And sorry, but you've deleted your question at the time I've encountered it. This does not help future persons who may be seeking a solution to a similar problem. Therefore we cannot tell if the first answer was unhelpful or if your question was too unclear. Please consider leaving the question intact and making a new response if you feel that you wish to pull back the question and not have it considered to answering. Another thing to do is to close the thread using Thread Tools and mark it as solved, along with a comment saying "I've decided not to follow-up on this, please ignore my original question."

Regards,

- RT
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] An issue about printf() function NoWeDoR Programming 1 07-15-2015 03:08 AM
Sed issue with finding a match on two sequential lines and deleting the previous line ulto Programming 3 10-26-2014 06:26 PM
/ is out of room + deleting issue + backing up PLEASE HELP jdmmis Linux - General 7 01-09-2009 12:44 PM
Compilation issue when Function is parameter in function call on LINUX sa20358 Linux - Software 2 07-24-2008 10:19 PM
KGDB function mapping issue jack_robinson Programming 1 02-23-2006 12:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration