Code Examples YNQ

Mount

				
					// Mount remote share using credentials
udSetCredentials(“userName”, “password”, “domain”);
nqAddMountA(“\\mountPoint”, “\\\\192.168.19.1\\sharedFolder”, 1);
				
			

Open, read, write and delete file

				
					// Mount remote share using credentials

udSetCredentials(“userName”, “password”, “domain”);

nqAddMountA(“\\mountPoint”, “\\\\192.168.19.1\\sharedFolder”, 1);

// Create a file on a remote share

NQ_HANDLE fileHandle = ccCreateFileA(“\\mountPoint\\file.txt”,

                                        FILE_AM_WRITE,

                                        FILE_SM_EXCLUSIVE,

                                        FILE_LCL_UNKNOWN,

                                        FALSE,

                                        0,

                                        FILE_CA_CREATE);

NQ_BYTE data[DATA_SIZE];

NQ_UINT dataSize = DATA_SIZE;

NQ_UINT writtenSize, readSize;

// Write to remote file

ccWriteFile(fileHandle, data, dataSize, &writtenSize);

// Read from a remote file

ccReadFile(fileHandle, data, dataSize, &readSize);

// Close file handle

ccCloseHandle(fileHandle);

// Delete a file on a remote share

ccDeleteFileA(“\\mountPoint\\file.txt”);
				
			

Delete file by name

				
					// Mount remote share using credentials

udSetCredentials(“userName”, “password”, “domain”);

nqAddMountA(“\\mountPoint”, “\\\\192.168.19.1\\sharedFolder”, 1);

// Delete a file on a remote share

ccDeleteFileA(“\\mountPoint\\file.txt”);
				
			

Browsing directory

				
					// Mount remote share using credentials

udSetCredentials(“userName”, “password”, “domain”);

nqAddMountA(“\\mountPoint”, “\\\\192.168.19.1\\sharedFolder”, 1);

// Open a directory on remote share

FindFileDataA_t fileData;

NQ_HANDLE dirHandle = ccFindFirstFileA(“\\\\192.168. 19.1\\sharedFolder\\*”, &fileData, 0);

if (dirHandle != NULL)

{

     // Get next file in the directory

     while (ccFindNextFileA(dirHandle, &fileData))

     {

          printf(“Filename: %s, fileSize:%u \n”, fileData.fileName, fileData.allocationSizeLow);

     }

     // Close directory handle

     ccFindClose(dirHandle);

}
				
			

Visuality systems uses technical, analytical, marketing, and other cookies. These files are necessary to ensure smooth operation of Voltabelting.com site and services and help us remember you and your settings. For details, please read our Privacy policy

Skip to content