473,396 Members | 2,011 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,396 software developers and data experts.

Having problem working with DAT files!

I want to know if there is any function in that reads a whole line from a file each time I use it. The file format is txt.
Jan 12 '07 #1
5 1321
RedSon
5,000 Expert 4TB
What methods are you using now instead of reading the entire line? Reading an entire line is the same as reading each char until you reach a '\n' or whatever Microsoft's version of a '\n' is.
Jan 12 '07 #2
What methods are you using now instead of reading the entire line? Reading an entire line is the same as reading each char until you reach a '\n' or whatever Microsoft's version of a '\n' is.
Thanks for replying.You mean I use a loop, get one character a time, concatinate them to a string until I reach a '\n' ?
Is there any simpler way for doing that?
Jan 12 '07 #3
RedSon
5,000 Expert 4TB
Yes, it depends on what libraries you want to use, or what your instructor allows. If it is an exercise in using file streams and reading bytes into strings I expect a loop will be your only answer.
Jan 12 '07 #4
horace1
1,510 Expert 1GB
What methods are you using now instead of reading the entire line? Reading an entire line is the same as reading each char until you reach a '\n' or whatever Microsoft's version of a '\n' is.
you can use fgets() in C
http://www.cplusplus.com/reference/clibrary/cstdio/fgets.html

and getline() in C++
http://www.cplusplus.com/reference/iostream/istream/getline.html
Jan 12 '07 #5
Example of how to use fgets/fputs(C code), function readin a line from stdin and send it to stdout , no loops:

int mygetline(char *line, int max)
{
if(fgets(line,max,stdin)==NULL) return 0;
else {fputs(line,stdout);
return 1;
}
}



Thanks for replying.You mean I use a loop, get one character a time, concatinate them to a string until I reach a '\n' ?
Is there any simpler way for doing that?
Jan 13 '07 #6

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

Similar topics

4
by: MLH | last post by:
I am having failures processing the following command and I wonder if you can tell me what I must do in order to have success. When I try to run source mysql_dump.sql.txt ==> it is a problem...
30
by: aka | last post by:
Hi I have a DB2 v8.1 on AIX and DB2 Connect EE on Solaris wich is connected to OS/390 DB2 subsystems via APPC / SNA. I have cataloged the DB2 Connect instance as tcpip node and then the Host DB...
1
by: StaZ | last post by:
Hi, I'm trying to set up the Name and Number of a FAX programmatically. I'm Using MS Access 2000 and Delrina WinFax PRO 10. here is my code : Public Sub SendFax()
6
by: Jamal | last post by:
I am working on binary files of struct ACTIONS I have a recursive qsort/mergesort hybrid that 1) i'm not a 100% sure works correctly 2) would like to convert to iteration Any comments or...
2
by: Max2006 | last post by:
Hi, I am using a asp.net hosting service and I don't have access to IIS MMC. I would like to implement a URL rewriting service so all urls with shape: http://domainname.com/nnnn.jpeg get...
3
by: i80and | last post by:
I'm working on a basic web spider, and I'm having problems with the urlparser. This is the effected function: ------------------------------ def FindLinks(Website): WebsiteLen = len(Website)+1...
0
by: pete | last post by:
Greetings all, I am going to attempt to describe the issue that I am having in full. I apologize ahead of time that this may be a long posting, however, I have found no other solution to my...
6
by: fpcreator2000 | last post by:
Hello everyone. I'm having problems with a page I've created that is used to insert data into a database. It uploads two files into two distinct folder, and it takes the filenames and inserts...
6
by: Pep | last post by:
Firstly, I'm not sure if this is the right group for this query, so please forgive me if I am wrong. My problem is that most users I distribute my software to cannot install it on their systems...
2
by: Jack | last post by:
Hi, Performance-wise, is there a difference between these 2 clauses? I assume a large database... 1) With the WHERE clause: Select FLD1, FLD2, FLD3 From myFile Where FLD1 = 1 And FLD2 = 1
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.