Reading File in AEIO plugin.
I know this is really basic, but I'm not sure how to actually open and read from a file using the SDK API.
For example in the VerifyFileImportable() function, a const A_UTF16Char is passed in contating the file path. How can I use this file path to open the file. Does the SDK provide functions for opening and reading a file, or are traditional fopen and fstream functions used? If the latter is true, then how can a A_UTF16Char be converted to a char string?
Any help would be very appreciated. Thanks!!
it up to you to open and read the file.
fopen, fread, and fclose will do the job.
as for conversion of the utf16 to a char:
char buffer8[1024] = {'\0'};//i like to initiate arrays. you don't have to.
char *char8 = buffer8;
A_UTF16Char *char16 = thatUTF16String;
while(*char16) {
*char8++ = *char16++;
char8 = NULL;
that's it. buffer8 is now filled with the string from the utf16, and is null terminated.
either make sure that the size of the buffer is big enough to contain the largest path you might get, or add a counter to the while loop to see you don't exceed the buffer size.
Similar Messages
-
PS Custom Format Plugin - Issue Reading Files 2GB & 4GB
Is this issue fixable within our format plugin code, or is it a photoshop limitation?
I am new to Photoshop & Photoshop Plugins. I have reviewed the sdk photoshop documentation & searched web on this subject.
I am working with a photoshop format plugin written by my predecessor who is no longer here.
The plugin is modeled after the simpleFormat plugin.
The plugin is being used on systems running Photoshop CS6 & CC on 64bit Windows 7 with 8GB or more memory.
The plugin allows a file of our format to be opened, read and written.
ISSUE:
The plugin works fine reading files < 2GB or > 4GB. For files between 2GB and 4GB, the call to allocate memory fails.
In the plugin's PIPL structure: the FormatMaxSize {32767, 32767} and PluginMaxSize {PlugInMaxSize { 2147483647, 2147483647 }
In the plugin code; the DoReadStart() method opens the file and reads the file header information. This works fine.
Next, in the DoReadContinue() method: SPsBuffer->New(&bufferSize, buffersize) is returning NULL. see below.
void PluginMain (const int16 selector,
FormatRecordPtr formatParamBlock,
intptr_t * data,
int16 * result)
gFormatRecord = reinterpret_cast<FormatRecordPtr>(formatParamBlock);
gPluginRef = reinterpret_cast<SPPluginRef>(gFormatRecord->plugInRef);
gResult = result;
gDataHandle = data;
sSPBasic = ((FormatRecordPtr)formatParamBlock)->sSPBasic;
if (gCountResources == NULL ||
gGetResources == NULL ||
gAddResource == NULL ||
gFormatRecord->advanceState == NULL)
*gResult = errPlugInHostInsufficient;
return;
// new for Photoshop 8, big documents, rows and columns are now > 30000 pixels
if (gFormatRecord->HostSupports32BitCoordinates)
gFormatRecord->PluginUsing32BitCoordinates = true;
static void DoReadPrepare()
gFormatRecord->maxData = 0
static void DoReadContinue (void)
int32 done;
int32 total;
int32 row;
VPoint imageSize = GetFormatImageSize();
/* Set up the buffer & progress variables. */
done = 0;
total = imageSize.v;
Ptr pixelData = NULL;
Ptr rawData = NULL;
Ptr uncompressedData = NULL;
int64* offsetTable = NULL;
/* allocate the pixel buffer. */
unsigned32 bufferSize = gFormatRecord->planes * imageSize.v * imageSize.h;
pixelData = sPSBuffer->New( &bufferSize, bufferSize ); <====== This allocation fails for file sizes > 2GB & < 4GB.
if (pixelData == NULL)
*gResult = memFullErr;
//return;
if(*gResult == memFullErr) { goto ReadContinueCleanUp; }Some examples of files that are successfully read and files that are not successfully read are shown below:
Filenames that contain "nok" as part of the name, would not open and an out of RAM error occurs.
in the ReadContinue method, shown in an earlier post on this thread.
Filenames
12x12ok
12x24ok
ok
nok
nok
nok
ok
hdots
17280
17280
23160
23180
30001
32768
32768
vdots
8640
17280
23160
23180
30001
32768
32768
hdots * vdots
149299200
298598400
536385600
537312400
900060001
1.074E+09
1.074E+09
hdots + vdots
25920
34560
46320
46360
60002
65536
65536
hdpi,vdpi
1440:720
1440:720
1440:720
1440:720
1440:720
1440:720
1440:720
#channels
4
4
4
4
4
4
5
#bpp
2
2
2
2
2
2
2
compression
Packbits
Packbits
Packbits
Packbits
Packbits
fileLength(bytes)
8593776
8647536
14365054
17063936
21258240
filesize (MB)
356
712
8.19
8.24
13.7
16.27
20.27
filesize (GB)
0.348
0.69
0.008
0.008
0.0134
0.016
0.0198 -
When I download firefox, using recommended setting, or my own, all the sub files/folders like plugins, modules, updater end up on the desktop as well as in the file location. And when I try to put them into the file location, they don't. And when I delete them, FireFox won't open. I tried deleting FireFox and reinstalling it multiple times, and a message pops up sometimes that says FireFox may not have installed correctly, so I follow the steps, but all the extra icons on my desktop don't go away. This has happened every time I have downloaded FireFox. The browser itself works, but I need to know how to get rid of these icons, but still be able to use FireFox. This is on a new computer, with Windows 7.
== I downloaded FireFox. ==
== User Agent ==
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6Managed to solve this myself. Just went to properties > hidden.
-
Reading file in Applet.
Hello All,
i am trying to read a file in applet. i have created a applet that reads file and prints its content. it works fine on local system but when i publish this applet in web server it gives such exceptions.
java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.liveconnect.SecureInvocation$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.liveconnect.PrivilegedCallMethodAction.run(Unknown Source)
... 4 more
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\reading\run.bat read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at readFile.showContent(readFile.java:38)
Can some body say whats going on?
I am stuck over here.
Any help will be appreciated.
Regards
Jaya N pasachhe.If you are surfing the web, and you click a link to a page that you don't know, you don't want some unknown Applet to start and be allowed access to your local harddrive or printer.
Therefore, Applets ran by the browser, run in a so-called "sandbox". Read about it.
The solution is to "sign" the applet's jar.
see http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-applet.html
and http://forum.java.sun.com/thread.jspa?threadID=174214 -
Camera Raw w Nikon D810-PS6 not reading files
Recently purchased Nikon D810, my PS6 not reading files. Tried downloading Adobe DNG Converter (8.6) as a work around, (but doesn't that reduce your original NEF file to about half?) and that didn't seem to work...Then I tried downloading the PS CC, (which I really didn't want to to do bc I just recently purchased PS 6, but I can't seem to get through the credit card screen... What am I doing wrong and once I do get the subscription, is PS CC now up to speed with these new RAW files for the Nikon?
I am so frustrated
Thanks
KWhich operating system are you using?
Photoshop cs6 should be able to open the Nikon D810 files.
If in photoshop cs6 you go to Help>About Plug-In (windows) or Photoshop>About Plug-In (mac) and click on the words Camera Raw, what version does it say?
Have you tried Help>Updates from within photoshop cs6 to get camera raw 8.6?
Also, how are you transferring the nikon nef files to your computer?
I ask because older versions of nikon transfer can corrupt the nef files in such a way that the photoshop camera raw plugin will not open them. -
Revision: 13604
Revision: 13604
Author: [email protected]
Date: 2010-01-18 17:09:32 -0800 (Mon, 18 Jan 2010)
Log Message:
Update build-config files for sample plugins.
Modified Paths:
osmf/trunk/apps/samples/plugins/AkamaiPluginSample/AkamaiPluginSample-build-config.xml
osmf/trunk/apps/samples/plugins/MASTSample/MASTSample-build-config.xmlThanks Brian. I would certainly appreciate the maintenance and documentation of some of these. The one that most comes to mind is the OSMFTest suite. This would be valuable if only so that developers have some idea of the coverage that's going on under the hood. It would also help for diagnosing what's going on when behavior is not as expected. I was pleased that when I figured out how to compile this directory, I could see that there were 1109 tests, all of which passed except for one that failed due to not being on my local security whitelist.
-
HOW TO DELETE ADOBE READER FILE FROM ADOBE READER
HOW TO DELETE ADOBE READER FILE FROM ADOBE READER@ !@
Your question make no sense. What exactly are you trying to do?
-
Reading Files from an FTP location based on Timestamp
Hi,
I have a requirement of reading files from an FTP location. The files should be read in the order they were saved in the folder. Can someone tell me how to solve this?
Thanks,
RaviHi Arik,
Thanks for your reply. I tried doing what u said, but it isn't working. My requirement is to List the files in the folder using FTP adapter and get the file name with the least file stamp from the FTP adapter and pass the FileName dynamically to another FTP adapter which reads the file based on the FileName. When i tested after including the property (for listing the files) you mentioned, it is giving the following error (copied from flow trace):
<messages>
<input>
<Invoke_getFileListFTP_FileListing_InputVariable>
<part name="Empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<empty xmlns="http://xmlns.oracle.com/pcbpel/adapter/ftp/APP_SequentialFileTransfer/PRJ_SequentialFileTransfer/WS_GetFileList_FTP"/>
</part>
</Invoke_getFileListFTP_FileListing_InputVariable>
</input>
<fault>
<bpelFault>
<faultType>0</faultType>
<bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
<part name="summary">
<summary>Exception occured when binding was invoked. Exception occured
during invocation of JCA binding: "JCA Binding execute of
Reference operation 'FileListing' failed due to: Exception
occured when binding was invoked. Exception occured during
invocation of JCA binding: "Could not instantiate
InteractionSpec
oracle.tip.adapter.ftp.outbound.FTPListInteractionSpec due
to: Cannot set JCA WSDL Property. Error while setting JCA
WSDL Property. Property setListSorter is not defined for
oracle.tip.adapter.ftp.outbound.FTPListInteractionSpec Please
verify the spelling of the property. ". The invoked JCA
adapter raised a resource exception. Please examine the above
error message carefully to determine a resolution. ". The
invoked JCA adapter raised a resource exception. Please
examine the above error message carefully to determine a
resolution.</summary>
</part>
<part name="detail">
<detail>Cannot set JCA WSDL Property. Error while setting JCA WSDL
Property. Property setListSorter is not defined for
oracle.tip.adapter.ftp.outbound.FTPListInteractionSpec Please
verify the spelling of the property.</detail>
</part>
<part name="code">
<code>null</code>
</part>
</bindingFault>
</bpelFault>
</fault>
<faultType>
<message>0</message>
</faultType>
</messages>
Thanks,
Ravi
Edited by: Ravi Santosh on Apr 24, 2012 11:02 PM -
Reading file from an external folder.
Iam tring to read an external file from the C:\ drive. Given below is the code.
DATA LV_XLS(100) TYPE C.
DATA LV_CONTENT TYPE XSTRING.
LV_XLS = 'C:\XML\Report.xls'
READ DATASET LV_XLS INTO LV_CONTENT.
But when i execute iam getting an error - FILE NOT FOUND. How do i read file from an external folder. My requirement is to strictly read from an external folder. Please help.
If this is not possible please advice as to how the file could be moved to the SAP root directory. Iam not able to locate the root.hi,
This is the code to read a excel file from the local system.
Read data set you are using in your code corresponds to files on application server thats the reason its throwing an error.
* Parameter variable declaration for browsing the file location *
PARAMETERS:
p_file TYPE ibipparms-path OBLIGATORY.
data:
it_text TYPE truxs_t_text_data .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
* DYNPRO_NUMBER = SYST-DYNNR
field_name = ' '
IMPORTING
file_name = p_file.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_tab_raw_data = it_text
i_filename = p_file
TABLES
i_tab_converted_data = t_cust
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This is to read a text file from local system.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\FILEINTERFACE\file.TXT'
* FILETYPE = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = t_kna1
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PS. In both of the above mentioned function modules make sure that the file structure is similar to the internal tables used.
Thanks
Sharath -
Hi,
Trying to read files from a dir on my site using a JSP and bean. I've tried nearly every option for the filepath I can think of and it doesn't seem to be finding the file...
Here's the bit:
String URL = "images\\wedding_photos\\";
File dir = new File(URL+aFile_to_add);
String[] files = dir.list();
It's working locally, but I obviously had to change the path from c://... to the above.
The full code is listed below in the addWedding Method
The method removes the .jpg from the file name and then writes the new file name to a database
Thanks for any insight.
Regards
Jim
public String addWedding(String aFile_to_add)
String feedback = "unset in scrubWedding";
try
String URL = "images\\wedding_photos\\";
Class.forName("org.gjt.mm.mysql.Driver");
java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/rhwedd2_shop?user=**********&password=*******");
java.sql.Statement statement = connection.createStatement();
File dir = new File(URL+aFile_to_add);
String[] files = dir.list();
if (files == null)
feedback = "Sorry, couldn't find the file "+aFile_to_add+"...no files have been added.";
else
for (int i=0; i<files.length; i++)
// Get filename of file or directory
String filename = files;
String no_extension;
//convert string array element into a char array
char [] charsfilename = filename.toCharArray();
int newlength = charsfilename.length -4;
no_extension = String.valueOf(charsfilename,0,newlength);
filesAdded = filesAdded+", "+no_extension;
// Show the new file names in stack trace without extension
//System.out.println("String no_extension " + no_extension );
statement.executeUpdate("INSERT INTO items VALUES ('"+no_extension+"',5,'"+aFile_to_add+"')");
// write to table with item_id and weddingid
feedback = "The following files have been added..."+filesAdded;
if (statement != null )
statement.close();
if ( connection != null )
connection.close();
catch(Exception e)
feedback = "Into the catch";
e.printStackTrace(System.err) ;
return feedback;
}//end addWeddingString URL = "images\\wedding_photos\\";
File dir = new File(URL+aFile_to_add); ok, ok, I'll answer...
1) What gives you the impression that the relative directory "images\\..." exists (or, in other words, what makes you think your current directory is the parent of "images"? -
Unable to read file from application server
Hi guys,
I am reading file(could be any extension) from application server,but some time i am successfuly able to read file and sometime unable to read,why its happening .
my code is here
OPEN DATASET E_FILE FOR INPUT IN BINARY MODE . "
IF SY-SUBRC = 0.
DO .
READ DATASET E_FILE INTO GS_PDF_TAB.
IF SY-SUBRC = 0.
APPEND GS_PDF_TAB TO GT_PDF_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET E_FILE.
ENDIF.
Thanks
Ankur SharmaHi,
What actually happens? Do you get a short dump? Do you get a return code ne 0? Does it run fine but you get no data in your table?
We aren't mind-readers and can't help much without more information.
Try using transaction AL11 to see if you access the files you are trying to open.
Gareth. -
Uploading and reading file from application server
Hi
My problem is when am uploading a file to application server it is getting stored in
usr/sap/transyp1/prod/in directory
after that i want to read that file from application server to update database
when using below code it is showing some other directory in f4 help
DATA: lv_hostname TYPE msxxlist-name.
DATA: lv_server TYPE bank_dte_jc_servername.
PARAMETERS: p_file TYPE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
IMPORTING
e_server = lv_server.
lv_hostname = lv_server.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FILE'
dyname = sy-cprog
dynumb = '1000'
filetype = 'P'
location = 'A'
server = lv_hostname.
experts could you please help me out
Thanks & Regards
Nagesh.ParuchuriUser Transaction file. You will get all logical file path names.
used following fucntion module to read file name and use command open dataset to read the file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = C_LOGICAL_FILENAME
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = P_IN_FILENAME
IMPORTING
FILE_NAME = P_OUT_FILENAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
IF SY-SUBRC <> 0.
MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
ENDIF. -
Open Data Set Error while trying to read file from non SAP server
Hi all,
is it possible to read data from non-SAP application Sever?
I'm using OPEN DATASET p_filin FOR INPUT IN LEGACY TEXT MODE CODE PAGE '1504',
Where p_filin is other Windows server.Our applicition server is under Unix.Is it a problem?
I make test to read file from SAP application server and it was ok.So how to call other server?
Thanks!Hi,
Yes it is possible to read data from a non SAP server through the statement OPEN DATASET.
The important thing to check is that the SAP Server got enough access to the non SAP server so it can perform a reading/writing process depending on your needs.
You should contact your network administrator and BASIS to help you check the permissions. This can be pretty tricky, specially if the servers are in different domains.
Regards,
Gilberto Li -
How to combine both DAQ AI signal, write and read file in single VI
Hi
I am the new user of LabVIEW version 7.1 for testing automation application. I have to measure 33 signals ( mostly analog like temp, pressure, etc...) from NI USB 6210 DAQ system and write in master file for future verfication.From real data or from master file back up have to write one more file if only the signal reaches steady state , which will used for analysis and same signals to be read from this file parallely & make a waveform and/or table display format.
Pl. help me to shortout this problem
note: I have plan to ugrade labVIEW version 2011 shortly, so let me know doing parrel acquistion write and read file for data analysis in same VI in version 7.1......Parallel operations in LabVIEW are very simple. Just code it in parallel and it will work.
Try taking a look at some of the examples in the NI Example Finder (Help > Find Examples). There you will find example for writing to and reading from files, as well as data acquistion in parallel with other operations.
You might need a producer/consumer architecture is you are acquiring data very quickly.
Chris
Certified LabVIEW Architect
Certified TestStand Architect -
Error ORA-20003: Cannot read file/... in Cash Management?
Dear All.
I am having this Error in the Cash Management Module on the bank statement load process
Error ORA-20003: Cannot read file /software/d01/oracle/interface/finance/inbound/email.9Nemail.13111507.3445704.cnv.
How do I resolve this error.
Thank you.Hi Lucy,
The error is probably due to one of the reasons:
1. There is no file in the location: /software/d01/oracle/interface/finance/inbound/email.9Nemail.13111507.3445704.cnv.
2. No permission on the file respective file.
Please get the assistance from the DBA to check on this.
Thanks &
Best Regards,
Maybe you are looking for
-
When I try to update or download an app, very often another Apple ID shows up in the Apple ID box and the cursor is in the Password box and I can't move it back to the Apple ID box in order to put my ID in! Apple ID looks like an email address of a
-
How to create guides for a responsive website in illustrator
Does anyone know of any illustrator plugins that will generate customized guides? I'm looking for something like you can do in InDesign with its Create Guides feature. Thanks, Paul
-
Satellite M70-340: screen went completely blue or black
Hi everyone, I just bougth a Satellite M70-340 notebook and twice tonight the display went into a single color (once black, once blue) and though I still could hear the windows working (I could hear the Windows alert sounds and MSN message alerts), t
-
How to use outer join in Corelated Update?
Hi, I am using outer join in correlated update comand. But it is not updating the line which is not retrived from the query. Below is the example. Update model_table a Set a.model = (Select b.model_name from parts_table b where b.
-
hi, Apologize if this has been asked already. What are the differences if any between - - controlling the display of portlet header/border in the provider.xml file (containerRenderer set to false) V/S - controlling in the page edit mode (edit default