Hi,
I have to process a very "wide" CSV file. Basically, the file does not
appear correctly in Notepad, WordPad etc because each line is 414 characters
wide. Ordinarily, I would have read the file into a StreamReader and
processed each line in turn e.g.
objSR = new StreamReader(st rFileSpec);
while ((strLineIn = objSR.ReadLine( )) != null)
{
// process the line
}
However, in this case, ReadLine() does not return the full 414 characters
which go to make up each line.
What are my options here? Should I use ReadBlock()? Or is a StreamReader not
even the correct object to do this sort of thing?
FYI, the file is downloaded from a legacy VMS mainframe via FTP, and it
appears that this process is inserting arbitrary carriage-returns because of
the line length. Excel also cannot import it correctly because of this,
although SQL Server's DTS can...
Also, if I reformat the file manually so that all the columns "line up", as
it were, I can process it normally with the ReadLine() method. Maybe the
answer is to remove all of the carriage-returns first, insert one every 414
characters and then process the file as normal?
Any assistance gratefully received.
Mark 1 1580
First off, I'd recommend my csv parser, http://www.geocities.com/shriop/index.html . I'd be interested in
seeing how my parser handles these lines that are causing you issues.
As far as ReadLine is concerned, I can't think of a way that there
could be random carriage returns inserted into the data that would trip
up ReadLine but would not trip up DTS unless the carriage returns that
you're seeing are actually part of the data and are contained in text
qualified fields. Can you post an example line of data from the file so
I can get a better idea of what exactly is going on?
Mark Rae wrote: Hi,
I have to process a very "wide" CSV file. Basically, the file does not appear correctly in Notepad, WordPad etc because each line is 414 characters wide. Ordinarily, I would have read the file into a StreamReader and processed each line in turn e.g.
objSR = new StreamReader(st rFileSpec);
while ((strLineIn = objSR.ReadLine( )) != null) { // process the line }
However, in this case, ReadLine() does not return the full 414 characters which go to make up each line.
What are my options here? Should I use ReadBlock()? Or is a StreamReader not even the correct object to do this sort of thing?
FYI, the file is downloaded from a legacy VMS mainframe via FTP, and it appears that this process is inserting arbitrary carriage-returns because of the line length. Excel also cannot import it correctly because of this, although SQL Server's DTS can...
Also, if I reformat the file manually so that all the columns "line up", as it were, I can process it normally with the ReadLine() method. Maybe the answer is to remove all of the carriage-returns first, insert one every 414 characters and then process the file as normal?
Any assistance gratefully received.
Mark This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Posadas, Dennis |
last post by:
I don't want to have to compile python, but I need one ready to support
unicode that includes CJK.
Dennis
|
by: Jonathan Mcdougall |
last post by:
I started using boost's filesystem library a
couple of days ago. In its FAQ, it states
"Wide-character names would provide an illusion of
portability where portability does not in fact
exist. Behavior would be completely different on
operating systems (Windows, for example) that
support wide-character names, than on systems
which don't (POSIX). Providing functionality that
appears to provide portability but in fact
|
by: J. C. Denton |
last post by:
I just manually validated alexa's global top 100
sites and find only 2 sites that pass validation.
They are
http://www.microsoft.com/
http://www.wikipedia.org/
All others should go w3c markup hall of shame, ;-)
|
by: kevininstructor |
last post by:
My group is in the process of replacing desktop computers with laptops for
several developers for primarily .NET development. What we thought about
this morning was the possibility of using an external 19" wide screen
monitor.
My question: Anyone have experience using a 19" wide screen? Do you like it
or would you have preferred a regular 19" monitor?
Side note: Although I have not tried this myself I am thinking 1024x768 or
|
by: mr |
last post by:
How can i 'force' c++ to interprete "blabla" strings as unicode string
instead of ascii string (i just don't want to add 'L' before the thousands
strings that are on my projects...), as all my projects are using unicode,
and i don't see any reason that c++ compilator keep creating ascii
Is it a way?
thanks !
| |
by: kellygreer1 |
last post by:
Is there an easy way from .NET to register a Windows-wide keyboard
shortcut? I would like to bring up a WinForm window from an already
running .NET application whenever this keyboard shortcut is used.
I assume the way to do this is calling the Windows API from .NET.
Anyone have an experience with this? or can you point me in the right
direction?
Thanks in advance,
Kelly Greer
|
by: Ioannis Vranos |
last post by:
Is printf("%ls") for printing wchar_t strings defined in C90, or it was
added in C95?
|
by: workingstiff19 |
last post by:
I just want people to click on a link to download a file. I've done
it before, but this is a new computer and I must be missing
something. (Possibly an Apache configuration setting?)
Here is the source for the link that generates the error:
<a href="./procedures/ODBC_installation.pdf">ODBC driver
installation procedure</a><br />
The permissions on the file and the directory containing it are wide
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |