The only code that is helpful is this:
fp = New IO.StreamReader (filename, New
System.Text.Uni codeEncoding(Tr ue, False), False)
If I pass a command line argument to my program that is not from Visual
Studio.NET is debug mode, the above code won't work, even though filename is
not changed whether I pass a command line argument or not. By not work, I
mean it will set fp.EndOfStream to true and fp.Peek() returns -1. The command
line argument is a file name, but not "filename" and is irrelevant. The file
is not concurrently open by any other program. Can someone please help me or
tell me how to work around what is probably is bug in VB.NET? 6 2365
Hi Forrest,
Does the code work if you run it in Visual Studio by setting the command
line arguments to the same filename in the Debug tab tot the Project
properties ?
Can you show the code that populates the filename variable ?
EG:
Sub Main(args() as String)
filename = args(0)
?
"Forrest Heller" <Forrest He****@discussi ons.microsoft.c omwrote in message
news:E4******** *************** ***********@mic rosoft.com...
The only code that is helpful is this:
fp = New IO.StreamReader (filename, New
System.Text.Uni codeEncoding(Tr ue, False), False)
If I pass a command line argument to my program that is not from Visual
Studio.NET is debug mode, the above code won't work, even though filename
is
not changed whether I pass a command line argument or not. By not work, I
mean it will set fp.EndOfStream to true and fp.Peek() returns -1. The
command
line argument is a file name, but not "filename" and is irrelevant. The
file
is not concurrently open by any other program. Can someone please help me
or
tell me how to work around what is probably is bug in VB.NET?
Oh whoops: here is the code that gets the command line arguments:
Private Sub MainForm_Load(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim i, cnt As Integer
'get cmd line params--for some reason they come with quotes (")
attached--guess this isn't Unix
Dim prog_args As String =
Microsoft.Visua lBasic.Command( ).Replace("""", "")
Triple post. I feel terrible.
For full disclosure, here is all code executed in Mainform_load until the
get_configurati on_list call
'failure to load config list?
Dim load_failure As Boolean = True
'let the DLL know the HWND
set_acoj_window (Me.Handle)
'set the parent of the reminder form to be me
rm.mparent = Me
'get configuration list
configurations = get_configurati ons(CONFIG_LIST _FILE)
As I said earlier, I'm lost on this code as it appears you are using a
constant, CONFIG_LIST_FIL E, not the actual command line argument.
BTW: for the command line argument you can use
Environment.Get CommandLineArgs , . Index 0 is your exe, index 1 is the first
argument. ,eg.:
filename = Environment.Get CommandLineArgs (1)
That will avoid the need to remove any enclosing quotation marks.
"Forrest Heller" <Fo***********@ discussions.mic rosoft.comwrote in message
news:CE******** *************** ***********@mic rosoft.com...
Triple post. I feel terrible.
For full disclosure, here is all code executed in Mainform_load until the
get_configurati on_list call
'failure to load config list?
Dim load_failure As Boolean = True
'let the DLL know the HWND
set_acoj_window (Me.Handle)
'set the parent of the reminder form to be me
rm.mparent = Me
'get configuration list
configurations = get_configurati ons(CONFIG_LIST _FILE)
I changed the file path to an absolute one with Application.Get StartupPath
and that worked! I don't know why, though, because a file without a specified
path is searched for in the current directory, right? As long as it
works...Thanks for your help, Bill.
I'm not sure I was any, but I'm glad you got it working :)
"Forrest Heller" <Fo***********@ discussions.mic rosoft.comwrote in message
news:62******** *************** ***********@mic rosoft.com...
>I changed the file path to an absolute one with Application.Get StartupPath
and that worked! I don't know why, though, because a file without a
specified
path is searched for in the current directory, right? As long as it
works...Thanks for your help, Bill.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: se7en |
last post by:
okay,
i cant seem to run a file with another file as an argument.
e.g I want to send the file "x.met" as an argument when running the file "y.py"
thanx
-python newbie-
|
by: pinkfloydhomer |
last post by:
I want to scan a file byte for byte for occurences of the the four byte
pattern 0x00000100. I've tried with this:
# start
import sys
numChars = 0
startCode = 0
count = 0
|
by: raydelex |
last post by:
I am new to securing a database with logins. My questions is: I want
only one database to use a new Workgroup file that I have created, not
all the Access databases that I bring up under my system login. Can
this be done?
Thanks
|
by: SunRise |
last post by:
Hi
I am creating a C Program , to extract
only-Printable-characters from a file ( any type of file) and display
them.
OS: Windows-XP
Ple help me to fix the Errors & Warnings and explain how to use
Command-Line Arguments inside C program.
|
by: Bill English |
last post by:
How do I associate file types with my application, and use its icon? Also is there an event I can use for when my application is loaded by opening those filetypes?
Ex. Open a .rtf, and I want my form to open that .rtf in its textcontrol.
| |
by: Paul |
last post by:
I have looked and looked for this info. All the I/O
examples I've found either explicity use a file name or use
the OpenFileDialog. When you drag a MS Word document over
MS Word, it launches and opens the document. I would like
my App to launch and open a document (if it has the correct
extension). What is the launch event sequence and where do
I pick up the path/name of the file or files that were
dropped on the application icon?
Any...
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: ohaqqi |
last post by:
Hi guys,
I'm still working on my shell. I'm trying to implement a function typefile that will take a command line input as follows:
> type <file1>
This command will implement a catenation of file1, equal to the command cat <file1>
I need to use execvp() and fork() system calls to create a new process that will type/cat any text file. In my code below, the execvp() call in the function at the bottom gets me the following:
...
|
by: arnuld |
last post by:
This is the partial-program i wrote, as usual, i ran into problems
halfway:
/* C++ Primer - 4/e
*
* Exercise 8.9
* STATEMENT:
* write a function to open a file for input and then read its
coontents into a vector of strings, storinig each line as separate
|
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: 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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |