473,554 Members | 3,224 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to read a flat file line by line

Adi
Hello eveyone,
I wanna ask a very simple question here (as it was quite disturbing
me for a long time.)
My problem is to read a file line by line. I've tried following
implementations but still facing problems:

Assume that
FILE* filePointer;
unsigned char lineBuffer[256];

1) Using fscanf: fscanf ( filePointer, "%[^\n]", lineBuffer);
The problem with this code is that fscanf behaviour is quite
unexpected. It sometimes increments the file pointer automatically and
sometime goes on reading the same line forerver.

2) Using fgets: fgets ( lineBuffer, 256, filePointer);
The problem here is that fgets also stores the '\n' in the
lineBuffer but what i need is just the complete line delimited by '\0'
before the end-of-line. Reason is that the file i'm reading might be a
DOS file where end-of-line is delimited by '\r\n'. So i want to skip
these end-of-line charater(s) no matter in which environment/OS the
file lies.

Is there any other way too to avoid this problem?? Please help me out
ASAP.
I'm using gcc version 3.4.5 on Red Hat Linux 7.1 2.96-79

Thanx in anticipation,
Adi

Sep 8 '06 #1
9 5193
"Adi" <ad******@gmail .comwrites:
[...]
Assume that
FILE* filePointer;
unsigned char lineBuffer[256];
[...]
2) Using fgets: fgets ( lineBuffer, 256, filePointer);
The problem here is that fgets also stores the '\n' in the
lineBuffer but what i need is just the complete line delimited by '\0'
before the end-of-line. Reason is that the file i'm reading might be a
DOS file where end-of-line is delimited by '\r\n'. So i want to skip
these end-of-line charater(s) no matter in which environment/OS the
file lies.
If you've opened the file in text mode, the end-of-line will appear in
the string as a single '\n' character, regardless of how it's
represented in the external file.

If you've read a complete line with fgets(), it's easy enough to get
rid of the trailing '\n': just replace it with a '\0'. But don't
assume that the '\n' will be there; if the input line is longer than
your buffer, or if you reach end-of-file before the end of the file,
you can get a partial line iwth no trailing '\n'.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 8 '06 #2
Hello Adi

Use fgets is the way I should do it

If you need only the string and not the control chars strip them like
this

fgets ( lineBuffer, 256, filePointer);

while(iscntrl(l ineBuffer[strlen( lineBuffer)-1])
{
lineBuffer[strlen( lineBuffer)-1] = '\0';
}

Greetings Olaf

Adi schreef:
Hello eveyone,
I wanna ask a very simple question here (as it was quite disturbing
me for a long time.)
My problem is to read a file line by line. I've tried following
implementations but still facing problems:

Assume that
FILE* filePointer;
unsigned char lineBuffer[256];

1) Using fscanf: fscanf ( filePointer, "%[^\n]", lineBuffer);
The problem with this code is that fscanf behaviour is quite
unexpected. It sometimes increments the file pointer automatically and
sometime goes on reading the same line forerver.

2) Using fgets: fgets ( lineBuffer, 256, filePointer);
The problem here is that fgets also stores the '\n' in the
lineBuffer but what i need is just the complete line delimited by '\0'
before the end-of-line. Reason is that the file i'm reading might be a
DOS file where end-of-line is delimited by '\r\n'. So i want to skip
these end-of-line charater(s) no matter in which environment/OS the
file lies.

Is there any other way too to avoid this problem?? Please help me out
ASAP.
I'm using gcc version 3.4.5 on Red Hat Linux 7.1 2.96-79

Thanx in anticipation,
Adi
Sep 8 '06 #3
Adi wrote:
>
.... snip ...
>
2) Using fgets: fgets ( lineBuffer, 256, filePointer);
The problem here is that fgets also stores the '\n' in the
lineBuffer but what i need is just the complete line delimited by
'\0' before the end-of-line. Reason is that the file i'm reading
might be a DOS file where end-of-line is delimited by '\r\n'. So
i want to skip these end-of-line charater(s) no matter in which
environment/OS the file lies.
So do many others (want to skip the '\n's). You can simply replace
fgets with ggets, the source for which is available at:

<http://cbfalconer.home .att.net/download/>

and is written in portable standard C, so it can be used anywhere.

--
"If you want to post a followup via groups.google.c om, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell. org/google/>
Also see <http://www.safalra.com/special/googlegroupsrep ly/>

Sep 8 '06 #4
Adi wrote:
>
Hello eveyone,
I wanna ask a very simple question here (as it was quite disturbing
me for a long time.)
My problem is to read a file line by line. I've tried following
implementations but still facing problems:

Assume that
FILE* filePointer;
unsigned char lineBuffer[256];

1) Using fscanf: fscanf ( filePointer, "%[^\n]", lineBuffer);
The problem with this code is that fscanf behaviour is quite
unexpected. It sometimes increments the file pointer automatically and
sometime goes on reading the same line forerver.
/* BEGIN pops_device.c */
/*
** If rc equals 0, then an empty line was entered
** and the array contains garbage values.
** If rc equals EOF, then the end of file was reached
** or there is some other problem.
** If rc equals 1, then there is a string in array.
** Up to LENGTH number of characters are read
** from a line of a text file or stream.
** If the line is longer than LENGTH,
** then the extra characters are discarded.
*/
#include <stdio.h>

#define LENGTH 12
#define str(x) # x
#define xstr(x) str(x)

int main(void)
{
int rc;
char array[LENGTH + 1];

puts("The LENGTH macro is " xstr(LENGTH));
fputs("Enter a string with spaces:", stdout);
fflush(stdout);
rc = fscanf(stdin, "%" xstr(LENGTH) "[^\n]%*[^\n]", array);
if (!feof(stdin)) {
getchar();
}
while (rc == 1) {
printf("Your string is:%s\n\n"
"Hit the Enter key to end,\nor enter "
"another string to continue:", array);
fflush(stdout);
rc = fscanf(stdin, "%" xstr(LENGTH) "[^\n]%*[^\n]", array);
if (!feof(stdin)) {
getchar();
}
if (rc == 0) {
*array = '\0';
}
}
return 0;
}

/* END pops_device.c */
>
2) Using fgets: fgets ( lineBuffer, 256, filePointer);
The problem here is that fgets also stores the '\n' in the
lineBuffer but what i need is just the complete line delimited by '\0'
before the end-of-line. Reason is that the file i'm reading might be a
DOS file where end-of-line is delimited by '\r\n'. So i want to skip
these end-of-line charater(s) no matter in which environment/OS the
file lies.
/* BEGIN products.c */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>

#define ARRAYSIZE 12
#define TAX(S) (0.06 * (S))
#define LIST { \
{"milk" , 2.59}, \
{"candy" , 1.21}, \
{"meat" , 1.69}, \
{"juice" , 1.29}, \
{"fruit" , 2.33} \
}
#define N_PRODUCTS (sizeof items / sizeof *items)

struct product {
char *name;
double price;
};

void Intro(void);
void Prompt(struct product *, size_t);
void Receipt(struct product *, size_t, unsigned *);
size_t OK_input(char *, size_t);
size_t OK_unsigned(lon g unsigned *);

int main(void)
{
struct product items[] = LIST;
unsigned quantity[N_PRODUCTS];
long unsigned quantity_temp;
size_t index = 0;

Intro();
do {
Prompt(items, index);
if (OK_unsigned(&q uantity_temp)) {
quantity[index++] = quantity_temp;
}
} while (index != N_PRODUCTS);
Receipt(items, index, quantity);
return 0;
}

void Intro(void)
{
putchar('\n');
}

void Prompt(struct product *items, size_t index)
{
printf("How much %s would you like to order: ",
items[index].name);
fflush(stdout);
}

void
Receipt(struct product *items,
size_t n_products, unsigned *quantity)
{
size_t index;
double subtotal, increase, tax;

puts("\n"
"Item Price Quantity T-Price\n"
"-----------------------------------------");
for (subtotal = index = 0; index != n_products; ++index) {
increase = quantity[index] * items[index].price;
subtotal += increase;
printf("%-7s%6.2f%12u%16. 2f\n",
items[index].name,
items[index].price, quantity[index], increase);
}
tax = TAX(subtotal);
printf("\n"
"%13s%-11s%17.2f\n"
"%13s%-11s%17.2f\n"
"%13s%-11s%17.2f\n",
"", "Subtotal ", subtotal,
"", "Sales Tax ", tax,
"", "Total Sales", subtotal + tax);
}

size_t OK_unsigned(lon g unsigned *quantity_ptr)
{
char array[ARRAYSIZE] = {'\0'};
size_t length;

length = OK_input(array, sizeof array);
if (length) {
if (strchr(array, '-')){
fputs("\nDon't use - in the number.\n", stderr);
length = 0;
} else {
char *endptr;

errno = 0;
*quantity_ptr = strtoul(array, &endptr, 10);
if (array != endptr - length) {
if (isdigit(endptr[-1])) {
size_t spindex = 0;

while (isspace(endptr[spindex])) {
++spindex;
if (endptr[spindex] == '\n') {
return 1;
}
}
}
fprintf(stderr, "\n"
"Don't use %-2s in the number.\n\n",
isspace(*endptr ) ? "\bblank spaces"
: isprint(*endptr ) ? endptr[1] = '\0', endptr
: "\bnonprint ing characters");
length = 0;
} else {
if (errno || *quantity_ptr ~0u) {
fprintf(stderr, "\n"
"Enter a number less than or equal "
"to %u.\n\n", ~0u);
length = 0;
}
}
}
}
return length;
}

size_t OK_input(char *array, size_t arraysize)
{
size_t length;

if (!fgets(array, arraysize, stdin) || feof(stdin)) {
if (ferror(stdin)) {
fputs("\n\n\nfe rror 1\n\n", stderr);
exit(EXIT_FAILU RE);
}
if (strlen(array)) {
fputs("\n\n\nfe of 1\n", stderr);
exit(EXIT_FAILU RE);
} else {
puts("\n\n\nDon 't do that!\n");
clearerr(stdin) ;
length = 0;
}
} else {
length = strlen(array) - 1;
if (length && (array[length] != '\n')) {
do {
if(!fgets(array , arraysize, stdin) || feof(stdin)){
if (ferror(stdin)) {
fputs("\n\n\nfe rror 2\n", stderr);
exit(EXIT_FAILU RE);
} else {
fputs("\n\n\nfe of 2\n", stderr);
exit(EXIT_FAILU RE);
}
} else {
length = strlen(array) - 1;
}
} while (array[length] != '\n');
printf("\n"
"Don't type more than %lu character%s\n"
"before hitting the Enter key.\n\n",
arraysize - 2lu, arraysize == 3 ? "" : "s");
length = 0;
}
}
return length;
}

/* END products.c */

>
Is there any other way too to avoid this problem??
/* BEGIN line_to_string. c */

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>

struct list_node {
struct list_node *next;
void *data;
};

int line_to_string( FILE *fp, char **line, size_t *size);
void list_free(struc t list_node *node, void (*free_data)(vo id *));
void list_fprint(FIL E *stream, struct list_node *node);
struct list_node *string_node(st ruct list_node **head,
struct list_node *tail,
char *data);

int main(void)
{
struct list_node *head, *tail;
int rc;
char *buff_ptr;
size_t buff_size;
long unsigned line_count;

puts(
"\nThis program makes and prints a list of all the lines\n"
"of text entered from standard input.\n"
"Just hit the Enter key to end,\n"
"or enter any line of characters to continue."
);
tail = head = NULL;
line_count = 0;
buff_size = 0;
buff_ptr = NULL;
while ((rc = line_to_string( stdin, &buff_ptr, &buff_size)) 1) {
++line_count;
tail = string_node(&he ad, tail, buff_ptr);
if (tail == NULL) {
break;
}
puts(
"\nJust hit the Enter key to end,\n"
"or enter any other line of characters to continue."
);
}
switch (rc) {
case EOF:
if (buff_ptr != NULL && strlen(buff_ptr ) 0) {
puts("rc equals EOF\nThe string in buff_ptr is:");
puts(buff_ptr);
++line_count;
tail = string_node(&he ad, tail, buff_ptr);
}
break;
case 0:
puts("realloc returned a null pointer value");
if (buff_size 1) {
puts("rc equals 0\nThe string in buff_ptr is:");
puts(buff_ptr);
++line_count;
tail = string_node(&he ad, tail, buff_ptr);
}
break;
default:
break;
}
if (line_count != 0 && tail == NULL) {
puts("Node allocation failed.");
puts("The last line entered didn't make it onto the list:");
puts(buff_ptr);
}
free(buff_ptr);
puts("\nThe line buffer has been freed.\n");
printf("%lu lines of text were entered.\n", line_count);
puts("They are:\n");
list_fprint(std out, head);
list_free(head, free);
puts("\nThe list has been freed.\n");
return 0;
}

int line_to_string( FILE *fp, char **line, size_t *size)
{
int rc;
void *p;
size_t count;

count = 0;
while ((rc = getc(fp)) != EOF) {
++count;
if (count + 2 *size) {
p = realloc(*line, count + 2);
if (p == NULL) {
if (*size count) {
(*line)[count] = '\0';
(*line)[count - 1] = (char)rc;
} else {
ungetc(rc, fp);
}
count = 0;
break;
}
*line = p;
*size = count + 2;
}
if (rc == '\n') {
(*line)[count - 1] = '\0';
break;
}
(*line)[count - 1] = (char)rc;
}
if (rc != EOF) {
rc = count INT_MAX ? INT_MAX : count;
} else {
if (*size count) {
(*line)[count] = '\0';
}
}
return rc;
}

void list_free(struc t list_node *node, void (*free_data)(vo id *))
{
struct list_node *next_node;

while (node != NULL) {
next_node = node -next;
free_data(node -data);
free(node);
node = next_node;
}
}

void list_fprint(FIL E *stream, struct list_node *node)
{
while (node != NULL) {
fputs(node -data, stream);
putc('\n', stream);
node = node -next;
}
}

struct list_node *string_node(st ruct list_node **head,
struct list_node *tail,
char *data)
{
struct list_node *node;

node = malloc(sizeof *node);
if (node != NULL) {
node -next = NULL;
node -data = malloc(strlen(d ata) + 1);
if (node -data != NULL) {
if (*head == NULL) {
*head = node;
} else {
tail -next = node;
}
strcpy(node -data, data);
} else {
free(node);
node = NULL;
}
}
return node;
}

/* END line_to_string. c */
/* BEGIN type_1.c */

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>

#define ARGV_0 "type_1"

int line_to_string( FILE *fp, char **line, size_t *size);

int main(int argc, char *argv[])
{
int rc;
FILE *fd;
char *buff_ptr;
size_t buff_size;

buff_size = 0;
buff_ptr = NULL;
if (argc 1) {
while (*++argv != NULL) {
fd = fopen(*argv, "r");
if (fd != NULL) {
while ((rc = line_to_string
(fd, &buff_ptr, &buff_size)) 0)
{
switch (rc) {
case EOF:
if (buff_ptr != NULL
&& strlen(buff_ptr ) 0)
{
puts("rc equals EOF\n"
"The string in buff_ptr is:");
puts(buff_ptr);
}
break;
case 0:
puts("realloc returned a null pointer "
"value in line_to_string. ");
if (buff_size 1) {
puts("rc equals 0\n"
"The string in buff_ptr is:");
puts(buff_ptr);
}
break;
default:
puts(buff_ptr);
break;
}
}
fclose(fd);
} else {
fprintf(stderr,
"\nfopen() problem with \"%s\"\n", *argv);
break;
}
}
free(buff_ptr);
} else {
puts(
"Usage:\n>" ARGV_0
" <FILE_0.txt<FIL E_1.txt<FILE_2. txt...\n"
);
}
return 0;
}

int line_to_string( FILE *fp, char **line, size_t *size)
{
int rc;
void *p;
size_t count;

count = 0;
while ((rc = getc(fp)) != EOF) {
++count;
if (count + 2 *size) {
p = realloc(*line, count + 2);
if (p == NULL) {
if (*size count) {
(*line)[count] = '\0';
(*line)[count - 1] = (char)rc;
} else {
ungetc(rc, fp);
}
count = 0;
break;
}
*line = p;
*size = count + 2;
}
if (rc == '\n') {
(*line)[count - 1] = '\0';
break;
}
(*line)[count - 1] = (char)rc;
}
if (rc != EOF) {
rc = count INT_MAX ? INT_MAX : count;
} else {
if (*size count) {
(*line)[count] = '\0';
}
}
return rc;
}

/* END type_1.c */

--
pete
Sep 8 '06 #5
Keith Thompson wrote:
>
If you've opened the file in text mode, the end-of-line will appear in
the string as a single '\n' character, regardless of how it's
represented in the external file.
[...]
Let's add a caveat, disclaimer, and weasel-word to that
nice-sounding guarantee: It's only true if the text file is
"well-formed" according to the system's conventions. If you
somehow get hold of a "foreign" file that hasn't been properly
translated to the local dialect, all bets are off.

The O.P. doesn't actually say that he needs to read "\r\n"-
terminated lines on an "\n"-only system, but there seems to be
a whiff of that possibility in the air. Maybe he's reading a
text file that was FTP'ed in binary mode, or a foreign-format
file residing on a shared disk, or ... He writes of the "\r\n"
in a way that makes me think he's actually found them in his
buffers. (Maybe he hasn't, but it sounds that way.)
If you've read a complete line with fgets(), it's easy enough to get
rid of the trailing '\n': just replace it with a '\0'. [...]
Right. And if the trailing '\n' is immediately preceded by
an '\r' he could obliterate that, too, trying to patch things up
for a file that was transferred from a DOS-ish environment to a
different one without proper translation. Ultimately, though,
that's a losing proposition: There are just too many different
line-ending conventions kicking around, and trying to burden your
program with understanding all of them (especially after they've
been garbled by unsuccessful translation) is attacking the wrong
end of the problem. If the O.P. faces trouble of this kind, it's
better to fix the file transfer procedures than to try to repair
the damage afterwards -- get the transfer/translation done right,
and you're back in the nice state of affairs Keith describes.

--
Eric Sosman
es*****@acm-dot-org.invalid

Sep 8 '06 #6
Adi
Thanx buddy for replying but I'd say that I've also tried printing
length of buffer. So try the code below and see that length is 2 for
empty line in DOS file and 1 for Linux.
Though I've made a code to avoid that but I'd prefer a library function
rather than my own manipulations :(
So if anyone has a very short answer to my question, I'd rather be more
grateful!!
Also can anyone tell me why using fcanf ( filePointer, "%[^\n]",
lineBuffer); is not working...thoug h it works for scanf???

#include <stdio.h>

int main(int argc, char *argv[])
{
int num, a, b;
char c, str[100];
FILE* fp;

if((fp = fopen(argv[1], "r")) != NULL)
while (fgets(str, 100, fp) != NULL)
{
//*(str + strlen(str) - 1) = '\0';
//fseek(fp, strlen(str) * sizeof(char), SEEK_CUR);
printf("%d)%s", strlen(str), str);
}
fclose(fp);
}

/*--------------code to remove trailing eon-of-file------*/
void strRemEOL(char* stringBuffer)
{
while(strlen(st ringBuffer) && ( (stringBuffer[strlen(stringBu ffer) -
1] == 13)\
|| ( stringBuffer[strlen(stringBu ffer) - 1] == 10 )))
stringBuffer[strlen(stringBu ffer) - 1] = 0;
}
Keith Thompson wrote:
--------------------------------
[...]
2) Using fgets: fgets ( lineBuffer, 256, filePointer);
The problem here is that fgets also stores the '\n' in the
lineBuffer but what i need is just the complete line delimited by '\0'
before the end-of-line. Reason is that the file i'm reading might be a
DOS file where end-of-line is delimited by '\r\n'. So i want to skip
these end-of-line charater(s) no matter in which environment/OS the
file lies.

If you've opened the file in text mode, the end-of-line will appear in
the string as a single '\n' character, regardless of how it's
represented in the external file.

If you've read a complete line with fgets(), it's easy enough to get
rid of the trailing '\n': just replace it with a '\0'. But don't
assume that the '\n' will be there; if the input line is longer than
your buffer, or if you reach end-of-file before the end of the file,
you can get a partial line iwth no trailing '\n'.
-----------------------------------------------------------------------

Sep 8 '06 #7
mdler wrote:
Hello Adi
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html >
Use fgets is the way I should do it

If you need only the string and not the control chars strip them like
this

fgets ( lineBuffer, 256, filePointer);

while(iscntrl(l ineBuffer[strlen( lineBuffer)-1])
{
lineBuffer[strlen( lineBuffer)-1] = '\0';
}
Computing strlen() twice in each iteration of the loop isn't the most
efficient way of doing things. Do it once, and decrement its value as
needed.

There shouldn't even be need to check for more than '\n' unless a text
file from a different OS was transfered or something.


Brian
Sep 8 '06 #8


mdler wrote On 09/08/06 03:29,:
Hello Adi

Use fgets is the way I should do it

If you need only the string and not the control chars strip them like
this

fgets ( lineBuffer, 256, filePointer);

while(iscntrl(l ineBuffer[strlen( lineBuffer)-1])
{
lineBuffer[strlen( lineBuffer)-1] = '\0';
}
Unsafe loop: What if you read a line consisting
of exactly one '\n' plus the terminating '\0'?

On the first iteration, strlen() will return 1
and you'll set lineBuffer[1-1] = '\0'. Fine so far.

On the second iteration, strlen() will return 0.
Subtracting 1 gives a large positive value (recall that
strlen() returns a value of type size_t, which is an
unsigned integer type); this value will be at least
65535, but on most systems it will be 4294967295 --
much larger than 255, in any event. Attempting to
inspect lineBuffer[(size_t)-1] yields undefined behavior;
so does the attempt to store there, if one is made.

... and although the run-off-the-start-of-the-array
bug is probably more serious, there is yet another bug
in the code, a bug I've grown weary of ranting about and
will leave as an exercise for the Astute Reader.

--
Er*********@sun .com

Sep 8 '06 #9
Eric Sosman <Er*********@su n.comwrites:
mdler wrote On 09/08/06 03:29,:
> fgets ( lineBuffer, 256, filePointer);

while(iscntrl( lineBuffer[strlen( lineBuffer)-1])
{
lineBuffer[strlen( lineBuffer)-1] = '\0';
}

Unsafe loop: What if you read a line consisting
of exactly one '\n' plus the terminating '\0'?
Furthermore: What if you read a line that begins with '\0'?
--
int main(void){char p[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+= strchr(p,*q++)-p;if(i>=(int)si zeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Sep 8 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5308
by: Yang Li Ke | last post by:
Hi guys! I have some datas that I must check everytime a visitor comes to my site What is better to do: 1- Read data from a file or 2- Read data from a mysql db Thank you
0
313
by: mwazir | last post by:
Dear all, I have a requirement while parsing a delimited flat file and I was wondering if there is a simpler solution that what I have in mind. Basically I need to pull out a line from the flat file and the information I am given is the line number and the name of the file. Therefore I have thought of implementing something like this. ...
5
2959
by: Knackeback | last post by:
task: - read/parse CSV file code snippet: string key,line; typedef tokenizer<char_separator<char> > tokenizer; tokenizer tok(string(""), sep); while ( getline(f, line) ){ ++lineNo; tok.assign(line, sep);
2
3288
by: Bill Nguyen | last post by:
I need to parse a text file with fixed columns into a table. I have the file spec (column positions) but don't know how to use it. Thanks Bill
1
2058
by: hkhella | last post by:
I receive several flat files daily that need to be improted into my Access Database. Each file record starts with a specific letter or group of letters, the following lines or rows in the flat file starts with an identifier followed by several data fields each seperated by ^ and each line end with ^. The record ends with a specific letter (T) or...
1
1913
by: gopiganguly | last post by:
Hi everyone, There is a small problem encountered while creating a package in sql server 2005. Actually i am using a flat file which has 820 rows and 2 columns which are seperated by line feed(for ROW) and tab(for COLUMN).after importing i found that ther are only 800 rows imported into the table. Ather verifying the input file i...
1
1135
pankajkmeena
by: pankajkmeena | last post by:
whenever i try to read a flat file (generated from Foxpro ) it reads on extra line. however VIM does not show that line (even after usinf se list feature) . Also length of that line is single character (as per strlen function). Any Help
15
5244
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to show - text boxes, input boxes, buttons, hyperlinks ie the usual. The data is not obtained directly from a database.
3
3158
by: Flugeldorph | last post by:
I am new to Visual Basic, my preferred languages is C or C++. I am trying to load a local database with data that I am reading from a delimited flat file. I have created the database tables and added all primary keys and a set of foreign keys. I have also created a Dataset for same. Now I was expecting that I could load the data set from the data...
0
7570
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7775
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8008
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7854
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5411
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5133
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3537
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3525
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1107
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.