473,387 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to write code...

char id_dir[PATH_MAX] = {0,};
strncpy(id_dir, a->id_file_name, PATH_MAX);
id_dir[PATH_MAX-1] = 0;
strncpy(id_dir, ".d/", PATH_MAX - strnlen(id_dir, PATH_MAX));
struct dirent *id_file = NULL;
do {
errno = 0;
dp = readdir(id_dir)
if (!dp)
break;
/* how add check here to ensure name ends in ".ids"(directory), skip if not. */
f = fopen(id_file, "r");
if(!f)
continue;
err = id_parse_list(a, f, @lino, 1);
fclose(f);
} while (id_file != NULL);
Nov 30 '06 #1
7 1562
your code does'nt have any sense, i think you'd better study first the tutorial of banfa, i think that can help you alot!!!!!!!!!!!!!!!!!

regards,
Nov 30 '06 #2
DeMan
1,806 1GB
That's one way to write code. What does it do?
Nov 30 '06 #3
That's one way to write code. What does it do?
this code is to check the entries in the directory(either current or any specified)...

in this code what i have to do is ..i have add the check to see wheather the name which is listed from this code is available in another directory called example d.ids..if name is available in that(d.ids) directory we have to continue...otherwise we have to skip
Nov 30 '06 #4
DeMan
1,806 1GB
so was there a question, or is this proof you can write code?
Dec 1 '06 #5
so was there a question, or is this proof you can write code?
no..iam asking help to solve this problem
Dec 2 '06 #6
DeMan
1,806 1GB
Not quite sure what the problem is, could you please specify what do you want help with?
Dec 2 '06 #7
DeMan
1,806 1GB
Sorry, missed this line:

/* how add check here to ensure name ends in ".ids"(directory), skip if not. */

not 100% sure what you mean, but I think....

firstly include the string.h library.

there is a function in it strstr(const char* string1,const char *substring) which returns a pointer so you could call
[code]
if(strstr(id_dir, ".ids")!=NULL)
{
//we are good process
}
else
{
//the substring wasn't found
}

NOTE: this is probably not the ideal solution, as it doesn't guarantee the suffix is a suffix, merely that it is in the string (you might want to check the pointer returned is 4 characters before the pointer to the end of the string)
Dec 2 '06 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Greg Hurlman | last post by:
I've got what I'm sure is a very simple problem. In an ASP page, I am trying to write out 4 fields from a recordset in succession: Response.Write rs("LastName") Response.Write rs("Suffix")...
1
by: techy techno | last post by:
Hii Just wanted to know how can I decorate my texboxes and Listmenu which is called from a JS file using the following code below: document.write("<SELECT NAME='cur2' ONCHANGE='cconv1();'>");...
3
by: Ike | last post by:
Can anyone discern why the following code writes the document.write() lines literally? That is, a line like document.write('<CENTER>') should write <CENTER> but instead writes the entire ...
2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
0
by: hari krishna | last post by:
hi all, My requirement is to generate xl reports throu Asp.Net without installing xl on web server computer. i am using Response object and wrtifile method as below. i dont know whether it is...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
14
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
5
by: matthew | last post by:
Hi all, I am now writing a aspx that get a session variable (string) and then write it out using Response.Write. The string length is: 494710. But Response.Write only write the string...
4
by: Billy | last post by:
Hi all, I'm building a text file from a database table using the ASP Write Method and would like to position the cursor in a specific column position before writing the fields. As I loop through...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.