|
|
Hi,
This is from Chandrakanth. working on C# with Asp.net.
Actually i have one problem ,
That is While copying the data from
Copy(Source File,DestinationFile) gettting "Ilegal charcters in a path"
Actually what we are doing is Converting Tiff File To TextFile through OCR.
I am getting data INTO STRING from Conversion from tiff to txt throgu OCR.
And Renaming the file with .txt.
And i want to move the data from STRING to txtFile.
Can any one tell me what to do for that.
That Code and all i am giving here .
string strFilePath = FileUpload1.PostedFile.FileName;
Process tessProc = new Process();
tessProc.StartInfo.WorkingDirectory = strFilePath; // @"C:\08122008_NY01_AST_1.0.tif"; // strFileName;
tessProc.StartInfo.FileName = @"D:\Chandrakanth\TesseractOCR08022009\bin.dbg\tesseract.exe";
string strFileName1;
int intLastIndexOfSlash;
if (strFilePath.IndexOf(@"\") == 0)
strFileName1 = strFilePath;
else
{
intLastIndexOfSlash = strFilePath.LastIndexOf(@"\");
strFileName1 = strFilePath.Substring(intLastIndexOfSlash + 1);
}
tessProc.StartInfo.Arguments = strFileName1 + " output"; tessProc.Start();
string output = File.ReadAllText(@"C:\output.txt");
TextBox1.Text = output;
string strOutPutFileName = System.IO.Path.GetFileNameWithoutExtension (strFileName1) + ".TXT";
string strSaveFilePath = Server.MapPath("");
File.Create(strSaveFilePath + @"\" + strOutPutFileName);
string illegal = output;
string regexSearch = string.Format("{0}{1}",
new string(Path.GetInvalidFileNameChars()),
new string(Path.GetInvalidPathChars()));
Regex r = new Regex(string.Format("[{0}]", Regex.Escape(regexSearch)));
illegal = r.Replace(illegal, "");
System.IO.File.Copy(illegal, strOutPutFileName);
Actually that illegal contains data in below format
------------------------------------------------------------------------
JMW -J
'me l^ T
l ii T T ASTER
^ WE INTEGRATE CDMIUIYICJTIOIVS
INVOIC E
ASTER TELE SERVICES FVT. LTD, Invoice No: EMHASDCGSE
Flat na.4 to 7, C/a Krlshna Plaza, Date: 13-Dec417 ,
Opp.WaLer Tanks, Near TATA Garden Busstop, .
Chandan Nagar, PUNE-14
PAN No AACCA54E9L P.O.NG: 4352
CST TIN is 2715000524SC w e.l01 04.2005 Date: MAMGY-W
\lAT TIN is 2715000524GV wel`01 O4 ZODG
ST Regn No. AACCAMSBLSTOUT
Kg Vodafnile Essar Cellular Lid.,
.)Mutropnlltan, F/P Null.
S,No. 21, Old Mumbalrvurla Highway,
Wakzdewadljhivaji Nagar, Site Name: Gad Mudslngi
PUNE 7 411005 TowsrType R1~l
Tower Height: 21 Mts
Natllreof Workmvaition Lamp, Llghting Arrester
EETEHWKJJMS lure lu. a' value la;.
1 Aviation lain 1 @1 avov s woo
Z Li htin Arrester 1 Nas ' 1SD(l 1,600
a Avlaiulun lam came XI arm no la are
1 ** . _
1 ]*__
1 ___ an svo
rli= anuue `rum include sel-vlces tax Amount of ns see _
I `rural niu==i== Value as eve
?
JJ Now Claimed nuowi. of xiivaiue value is slo
(Rupees Thirteen Thousand Slx Hundred and Seventy un!y)
For ASTER TELE SERVICES PVT LTD 7
/ ^ i
Aurlu=rls= slguauiry I
4
ASTER TELESERVICES PVILTD.
4~7 Krlshnla Pbxa, Opp. WalerTarll<, NearTaln Garden Bus Slap, Otlendan Nsgar, Fune -41l 014
2* Phone :(Qll) 020 - 21034495, 323445413, 32,540369, Tetetax : 020 ~ 21034495.
-------------------------------------------------------------------------
System.IO.File.Copy(illegal, strOutPutFileName);
Actually i want to move the data from illegal to strOutPutFileName
here i am getting error
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
for this line
System.IO.File.Copy(illegal, strOutPutFileName);
Can anyb one tell how to do that ASAP?
Thanks and Regards
Chandrakanth
|
|
|
|
|
chandragaddam wrote: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Can you confirm that your path and filename are NOT that long ? Or does the error mean what it says ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
Once again from Chandrakanth.
That file name is in the format of (Tiff File)-- 08122008_NY01_AST_3.0.tif
After Conversion the file will be going to change like 08122008_NY01_AST_3.0.txt.
.txt file is going to store in Application directory.
The Application directory is in
"D:\Chandrakanth\TesseractOCR08022009"
That application name is "TesseractOCR08022009"
And that illegal contains Data. I want to move that to "08122008_NY01_AST_3.0.txt." this txtfile.
While moving data i am getting error.
Could u pls give me some response on thar ASAP.
Thanks and Regards
Chandrakanth
|
|
|
|
|
Looking at the length of the subject of your post, it does not surprise me you have trouble with long names.
|
|
|
|
|
Hi,
I am working in an application of extracting the outlook.pst file annd export its emails data to an Ms-excel file or any other database like ms-access.I know, how to use outlook dll and extract inbox,outbox etc. folders and save them in disk but unable to export them in excel file.So plz ant one can help me in this application.
|
|
|
|
|
|
I am using webbrowser control in a window application using C# 2.0, its a testing tool, whenever i open a site from within the application, when i click any tab or any button or hyperlink for the fisrt time it give me the error dailog box with,
Run time error has occured
Error:Object doesn't support this property or method.
Please suggest what is the resolution.
The system is having IE 6.0 version.
|
|
|
|
|
Without seeing any code, it will be very hard to tell you what you did wrong. Step through the code and find out exactly what line of code is triggering that error.
|
|
|
|
|
in c#. are primitives such as int (which behind-the-scenes are structs i.e. System.Int32) therefore objects? since primitives are pass by value, it contradicts the fact that objects are pass by reference? please anyone enlighten me. thanks.
----------------------------------------------------------
this is a sig++
|
|
|
|
|
swjam wrote: ince primitives are pass by value, it contradicts the fact that objects are pass by reference?
Correct. An int is only an object if it's boxed ( that is, put in an object ) for the purpose of being passed as an object. Otherwise, it is not.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
swjam wrote: it contradicts the fact that objects are pass by reference?
Well, actually everything is passed by value (unless you specify otherwise). When you pass an object you are actually passing the reference to the object, and as the reference is a value type it's passed by value, i.e. the value of the reference is copied.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
swjam wrote: therefore objects?
Structure is a value type. Hence, int(System.Int32) is a value type being a structure. And so, it is passed by value.
|
|
|
|
|
thanks but that's not really the point i'm after.
----------------------------------------------------------
this is a sig++
|
|
|
|
|
i thought u were confused about primitive data type (like int) being passed as an object.
|
|
|
|
|
Well, then what are you asking?
|
|
|
|
|
if primitives are objects (because everything are) then they should be passed by reference. well i'm after the contradiction, i know for a fact that they are passed by value. (i think Christian Graus' answered it).
----------------------------------------------------------
this is a sig++
|
|
|
|
|
Yes, everything boils down to an object, but remember those primative types (Int32, Int16, etc) actually inherit from ValueType which itself inherits from Object .
The point here I think you're trying to grasp is that the runtime treats things that inherit from ValueType different from things that don't
|
|
|
|
|
If it inherits from System.Object it is an object.
The enlightened answer to why this doesn't contradict anything is buried in Computer Science course work. But if I recall correctly a short answer would be the value of the pointers to objects are passed and the compiler knows based on the type to dereference the pointer to yield the object data from the heap. If you could directly alter the stack in C# you would be able to change the value pushed on the stack for the object without affecting the referenced in the calling code because it would just be a value reference.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
hi,
I am having 3-4 records in my database. I written code to display records from the database to datagridview. I use cellclick event for editing the records.
Now datagridview has by default sorting. But Now when ever I click on the column header it will display error. Sorting is not happening becos of the cellclick event.
What can I do?
Thanks
sjs
|
|
|
|
|
Could you write here what error you are getting while clicking.
|
|
|
|
|
i installed a windows service developed in xp
when i run that service
I receive a popup stating Interactive Services Dialog Detection
A program can't display a message on your screen - the program may need
information or permission to complete a task.
how to over come this? please help me out
thanks in advance..
arun
|
|
|
|
|
You're trying to display a message and the user the service runs under, can't do that. Vista is just telling you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
is there any method to avoid this message by giving some permissions or something else...
thanks in advance
arun
|
|
|
|