Login Page - Create Account

Support Board


Date/Time: Wed, 05 Feb 2025 21:58:57 +0000



Post From: Does anyone know how to format the file pathway for exporting to csv file

[2025-01-31 03:28:47]
drinkcodejava - Posts: 5
I'm running VMWare Fusion. I tried just running this part of your code and it worked:

SCString FilePath = "Test.csv"; // Get the file path

if (sc.Index == sc.ArraySize - 1) // Check if it's the last bar
{
int FileHandle; // Declare FileHandle for file operations
// Open the file at the specified path in append mode
sc.OpenFile(FilePath, n_ACSIL::FILE_MODE_OPEN_TO_APPEND, FileHandle);

unsigned int BytesWritten = 0;

// Write data to the file
sc.WriteFile(FileHandle, "Test Line\r\n", 11, &BytesWritten);

// Close the file after writing
sc.CloseFile(FileHandle);
}

...so my suggestion is to start from there (w/o the if (sc.SetDefaults) block). For me, this code writes the file into the \Data folder. When I changed "Test.csv" to "Tmp\Test.csv" or "\Tmp2\Test.csv", I just ended up with a file named TmpText.csv and Tmp2Test.csv, so I don't think you can specify a directory path. The compiler finishes, but it complains about the backslashes. I think you are limited to just having the file written into the \SierraChart\Data folder.

Hope this helps!