logical pc0_ImportProtokoll :: WriteXMLActionsFile (char *xml_string )
{
  NString     cpath;
  char        filename[65];
  char       *fname = filename;
  logical     term   = NO;
BEGINSEQ
  GetImportFolder(cpath);
  CTXSETEV1(cpath,0)
//  if ( MakePathDirectories(cpath) )                 CTXERR(20)
  
  strcpy(filename,"XMLActions_99999999.xml");
  gvtxltp(filename,GPH("__AUTOIDENT")->GetInt(),strlen(filename));

  cpath += filename;
  CTXSETEV1(cpath,0)
  if ( WriteTextFile(cpath,xml_string) )              CTXERR(20)

  *GPH("xml_file_name") = filename;
      

RECOVER
  term = YES;
ENDSEQ
  return(term);
}
Пример #2
0
	void XMLFileSerializer::Write(
		XMLContainer & container,
		DirectoryMode mode
		)
	{
		tstring buffer = WriteFile(container);
		WriteTextFile(m_File, buffer, mode);
	}
Пример #3
0
int SaveArrayCSV(const char* chrFilePath, float* lpArray, U32 count)
{
	DAnsiStr strLine;
	for(U32 i=0; i<count; i++)
	{
		if(i < count - 1)
			strLine += printToAStr("%f, ", lpArray[i]);
		else
			strLine += printToAStr("%f", lpArray[i]);
	}

	WriteTextFile(DAnsiStr(chrFilePath), strLine);
	return count;
}
BOOL CTextFile::Save( CString& filename, CListBox* list )
/* ============================================================
	Function :		CTextFile::Save
	Description :	Saves the contents of the CListBox list to 
					the file filename. The file will be created 
					or overwritten.
					If filename is empty, the standard file 
					dialog will be displayed, and - if OK is 
					selected - filename will contain the 
					selected filename on return.
					
	Return :		BOOL				-	FALSE if failure. 
											GetErrorMessage will 
											return the error.
	Parameters :	CString& filename	-	name of file to save 
											to. Will be 
											overwritten
					CListBox* list		-	pointer to CListBox 
											to get text from

   ============================================================*/
{
	BOOL result = FALSE;

	// Error checking
	if( ValidParam( list ) )
	{

		// Get listbox contents
		CStringArray contents;
		int max = list->GetCount();
		for( int t = 0; t < max ; t++ )
		{

			CString line;
			list->GetText( t, line );
			contents.Add( line );

		}

		// Write file
		if( WriteTextFile( filename, contents ) )
			result = TRUE;

	}

	return result;

}
int SaveArrayCSV(const char* lpArrayName, float* lpArray, U32 count)
{

	DAnsiStr strPath = ExtractFilePath(GetExePath());
	DAnsiStr strFP = printToAStr("%s/%s", strPath.ptr(), lpArrayName);
	DAnsiStr strLine;
	for(int i=0; i<count; i++)
	{
		if(i < count - 1)
			strLine += printToAStr("%f, ", lpArray[i]);
		else
			strLine += printToAStr("%f", lpArray[i]);
	}

	WriteTextFile(strFP, strLine);
	return count;
}
BOOL CTextFile::Save( CString& filename, CEdit* edit )
/* ============================================================
	Function :		CTextFile::Save
	Description :	Saves the contents of the CEdit edit to the 
					file filename. The file will be created or 
					overwritten.
					If filename is empty, the standard file 
					dialog will be displayed, and - if OK is 
					selected - filename will contain the 
					selected filename on return.
					Note that the eol-öarkers from the editbox
					will be used.

	Return :		BOOL				-	FALSE if failure. 
											GetErrorMessage will 
											return the error.
	Parameters :	CString& filename	-	name of file to save 
											to. Will be 
											overwritten
					CEdit* edit			-	pointer to CEdit to 
											get text from

   ============================================================*/
{
	BOOL result = FALSE;

	// Error checking
	if( ValidParam( edit ) )
	{

		// Get text
		CString contents;
		edit->GetWindowText( contents );

		// Write file
		if( WriteTextFile( filename, contents ) )
			result = TRUE;

	}

	return result;

}
Пример #7
0
int main(int argc, const char * argv[])
{
	if (argc < 5)
	{
		printf("!!!Error: Not enough arguments. <first_long_number_filename> [ + | - | * | / | % | ^ ] <second_long_number_filename> <result_long_number_filename>!!!\n");
		return 0;
	}

	if (argc > 7)
	{
		printf("!!!Error: Many arguments. <first_long_number_filename> [ + | - | * | / | % | ^ ] <second_long_number_filename> <result_long_number_filename> <module_long_number_filename> <-b>!!!\n");
		return 0;
	}

	FILE* firstLongNumFile = fopen(argv[1], "r");	
	if (!firstLongNumFile)	//проверка открытия первого файла с числом
	{
		printf("!!!Error: Unable to open file: %s !!!\n", argv[1]);
		return 0;
	}
	fclose(firstLongNumFile);

	const char* operation = argv[2];	
	if ((strlen(operation) > 1 || operation[0] == '\0') || operation[0] != '+' && operation[0] != '-' && operation[0] != '*' && operation[0] != '/' && operation[0] != '%' && operation[0] != '^')	//проверка оператора
	{
		printf("!!!Error: Wrong operation: %s !!!\n", operation);
		return 0;
	}

	FILE* secondLongNumFile = fopen(argv[3], "r");	//проверка открытия второго файла с числом
	if (!secondLongNumFile)
	{
		printf("!!!Error: Unable to open file: %s !!!\n", argv[3]);
		return 0;
	}
	fclose(secondLongNumFile);

	FILE* resultLongNumFile = fopen(argv[4], "r");
	if (!resultLongNumFile)	//проверка открытия файла для результата
	{
		printf("!!!Error: Unable to open file: %s !!!\n", argv[4]);
		return 0;
	}
	fclose(resultLongNumFile);

	////////////////////////////////////////////////////////////////////////////////

	int bin = 0; //флаг для бинарного файла

	if (argc == 5)
	if (argv[2][0] == '^')
	{
		printf("!!!Error: Input module file!!!\n");
		return 0;
	}

	if (argc == 6)
	{
		if (argv[2][0] == '^')
		{
			FILE* moduleLongNumFile = fopen(argv[5], "r");
			if (!moduleLongNumFile)
			{
				printf("!!!Error: Unable to open file: %s !!!\n", argv[5]);
				return 0;
			}
			fclose(moduleLongNumFile);
		}
		else
		{
			if (strcmp(argv[5], "-b"))
			{
				printf("!!!Error: Invalid flag: %s !!!\n", argv[5]);
				return 0;
			}
			bin = 1;
		}

	}

	if (argc == 7)
	{
		FILE* moduleLongNumFile = fopen(argv[5], "r");
		if (!moduleLongNumFile)
		{
			printf("!!!Error: Unable to open file: %s !!!\n", argv[5]);
			return 0;
		}
		fclose(moduleLongNumFile);

		if (strcmp(argv[6], "-b"))
		{
			printf("!!!Error: Invalid flag: %s !!!\n", argv[6]);
			return 0;
		}
		bin = 1;
	}

	struct LongNumber a, b;

	//загружаем первое число из бинарного файла
	if (bin == 1)
		a = ReadBinFile(argv[1]);
	else
		a = ReadTextFile(argv[1]);

	//загружаем второе число из бинарного файла
	if (bin == 1)
		b = ReadBinFile(argv[3]);
	else
		b = ReadTextFile(argv[3]);

	//выполняем операцию 

	struct LongNumber result;

	switch (operation[0]) {
	case '+':
	{
				result = ADD(a, b);
				break;
	}
	case '-':
	{
				result = SUB(a, b);
				break;
	}
	case '*':
	{
				result = MUL(a, b);
				break;
	}
	case '/':
	{
				result = DIV(a, b, 1);
				break;
	}
	case '%':
	{
				result = DIV(a, b, 2);
				break;
	}
	case '^':
	{
				struct LongNumber c;
				if (bin == 1)
					c = ReadBinFile(argv[5]);
				else
					c = ReadTextFile(argv[5]);

				result = DEGREE(a, b, c);
				c = clear(c);
				break;
	}
	default:
		break;
	}

	//записываем в файл результат
	if (bin == 1)
		WriteBinFile(argv[4], result);
	else
		WriteTextFile(argv[4], result);


	a = clear(a);
	b = clear(b);
	result = clear(result);


	return 0;
}
Пример #8
0
void ClassLN::WriteText(const char* filename)
{
    WriteTextFile(filename, this->num);
}
Пример #9
0
void BETABRITE::WritePriorityTextFile ( const char *Contents, const char initColor, const char Position, const char Mode, const char Special )
{
	WriteTextFile ( BB_PRIORITY_FILE_LABEL, Contents, initColor, Position, Mode, Special );
}
Пример #10
0
	void Logger::SaveLogFile()
	{
		WriteTextFile(_T("StarLog.txt"), m_LogStream.str(), DirectoryMode::internal);
	}