您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FileToString函数代码示例

51自学网 2021-06-01 20:46:13
  C++
这篇教程C++ FileToString函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FileToString函数的典型用法代码示例。如果您正苦于以下问题:C++ FileToString函数的具体用法?C++ FileToString怎么用?C++ FileToString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FileToString函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FileToString

bool Soy::FileToString(std::string Filename,std::string& String){	auto& Stream = std::Debug.LockStream();	auto Result = FileToString( Filename, String, Stream );	std::Debug.UnlockStream( Stream );	return Result;}
开发者ID:SoylentGraham,项目名称:SoyLib,代码行数:7,


示例2: LoadTypeList

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%  L o a d T y p e L i s t s                                                  %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  LoadTypeList() loads one or more type configuration files which provides a%  mapping between type attributes and a type name.%%  The format of the LoadTypeLists method is:%%      MagickBooleanType LoadTypeLists(const char *filename,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o filename: the font file name.%%    o exception: return any errors or warnings in this structure.%*/static MagickBooleanType LoadTypeLists(const char *filename,  ExceptionInfo *exception){#if defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT)  return(LoadTypeList(TypeMap,"built-in",0,exception));#else  char    *font_path,    path[MaxTextExtent];  const StringInfo    *option;  LinkedListInfo    *options;  MagickStatusType    status;  status=MagickFalse;  *path='/0';  options=GetConfigureOptions(filename,exception);  option=(const StringInfo *) GetNextValueInLinkedList(options);  while (option != (const StringInfo *) NULL)  {    (void) CopyMagickString(path,GetStringInfoPath(option),MaxTextExtent);    status&=LoadTypeList((const char *) GetStringInfoDatum(option),      GetStringInfoPath(option),0,exception);    option=(const StringInfo *) GetNextValueInLinkedList(options);  }  options=DestroyConfigureOptions(options);  font_path=GetEnvironmentValue("MAGICK_FONT_PATH");  if (font_path != (char *) NULL)    {      char        *option;      /*        Search MAGICK_FONT_PATH.      */      (void) FormatLocaleString(path,MaxTextExtent,"%s%s%s",font_path,        DirectorySeparator,filename);      option=FileToString(path,~0UL,exception);      if (option != (void *) NULL)        {          status&=LoadTypeList(option,path,0,exception);          option=DestroyString(option);        }      font_path=DestroyString(font_path);    }  if ((type_list == (SplayTreeInfo *) NULL) ||      (GetNumberOfNodesInSplayTree(type_list) == 0))    status&=LoadTypeList(TypeMap,"built-in",0,exception);  return(status != 0 ? MagickTrue : MagickFalse);#endif}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:82,


示例3: FileToStringLines

bool Soy::FileToStringLines(std::string Filename,ArrayBridge<std::string>& StringLines,std::ostream& Error){	//	get file as string then parse	std::string FileContents;	if ( !FileToString( Filename, FileContents, Error ) )		return false;		Soy::SplitStringLines( StringLines, FileContents );	return true;}
开发者ID:SoylentGraham,项目名称:SoyLib,代码行数:10,


示例4: Sleep

void Resume::ReadVlcResumeFile(){	Sleep(100); //wait for VLC to write file (TODO: make threaded)	//get username	TCHAR username[UNLEN + 1];	DWORD username_len = UNLEN + 1;	GetUserName(username, &username_len);	RString strTemp;	RString strVlcFile;	//build path to vlc info file	RString strFilePath = _T("C://Users//");	strFilePath += username;	strFilePath += _T("//AppData//Roaming//vlc//vlc-qt-interface.ini");	//read VLC resume file into str	if (!FileToString(strFilePath, strVlcFile))		return;	if (GetFirstMatch(strVlcFile, _T("list=([^$]*?$)"), &strTemp))	{		strTemp.Replace(_T(" "), _T(""));		RArray<const TCHAR*> moviesTemp = SplitString(strTemp, _T(","), true);		size = moviesTemp.GetSize();		if (size > MAX_SIZE) size = MAX_SIZE;		for(int i=0; i<size; i++)		{			//remove % codes and turn + to space			RString strTempMovie = URLDecode(moviesTemp[i]);			//remove file:/// or file://			if (strTempMovie.Left(8) == _T("file:///"))				strTempMovie = strTempMovie.Right(strTempMovie.GetLength() - 8);			else				strTempMovie = strTempMovie.Right(strTempMovie.GetLength() - 5);			strTempMovie.Replace(_T("/"), _T("////"));			movies[i] = strTempMovie;		}	}	if (GetFirstMatch(strVlcFile, _T("times=([^$]*?$)"), &strTemp))	{		strTemp.Replace(_T(" "), _T(""));		RArray<const TCHAR*> strTimes = SplitString(strTemp, _T(","), true);		for(int i=0; i<strTimes.GetSize(); i++)			times[i] = StringToNumber(strTimes[i])/1000;  //milliseconds to seconds	}	UpdateResumeTimes();}
开发者ID:anlarke,项目名称:MovieExplorer,代码行数:55,


示例5: ShaderSourceFromFiles

void CShader::ShaderSourceFromFiles(std::list<std::string> pShaderFilePaths){    //for each shader file path, add it to the string list    std::list<std::string> fileData;    for (auto i : pShaderFilePaths)    {        fileData.push_back(FileToString(i));    }    //use the integrated support for string lists    ShaderSource(fileData);}
开发者ID:KevinMackenzie,项目名称:QuicksandEngine,代码行数:13,


示例6: LoadShader

///// Cree un shader object, charge le code source du shader et le compile//static GLuint LoadShader(GLenum type, const char *sourceFile){	// Preload le fichier de shader	char *shaderSrc = FileToString(sourceFile);	if (shaderSrc == NULL) {		return false;	}		// Cree le shader object	GLuint shader = glCreateShader(type);	if (shader == 0) {		return 0;	}	// Load the shader source	glShaderSource(shader, 1, (const char **)&shaderSrc, NULL);	// Compile le shader	glCompileShader(shader);	// on n'a plus besoin du fichier texte	free(shaderSrc);	// verifie le status de la compilation	GLint compiled;	glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);	if (!compiled) 	{		GLint infoLen = 0;		glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);		if (infoLen > 1)		{			char* infoLog = (char *)malloc(sizeof(char) * infoLen);			glGetShaderInfoLog(shader, infoLen, NULL, infoLog);			printf("Error compiling shader:/n%s/n", infoLog);  			free(infoLog);		}		// on supprime le shader object car il est inutilisable		glDeleteShader(shader);				return 0;	}	return shader;}
开发者ID:Epono,项目名称:5A-3DJV-OpenGL_Project,代码行数:54,


示例7: LexSource

SourceFile LexSource(const char* file){    (void)IsEscapeSequence;    SourceFile result;    result.file = file;    result.source = FileToString(file);    //std::cout << file << '/n' << _sourceCode << '/n';        SourceReader reader;    reader.source = result.source.data();    reader.index = 0;    reader.length = (int)result.source.size();    reader.position = {1, 1};        while (reader.Read() && reader.errorMessage.empty())    {        switch (reader.lastSourceToken.tokenType)        {            case TokenType::StringLiteral:                reader.lastSourceToken.tokenIndex = result.strings.size();                result.strings.push_back(reader.buffer);                break;            case TokenType::CodePointLiteral:            case TokenType::Float32Literal:            case TokenType::Float64Literal:            case TokenType::SignedIntegerLiteral:            case TokenType::UnsignedIntegerLiteral:                reader.lastSourceToken.tokenIndex = result.literals.size();                result.literals.push_back(reader.literal);                break;            default: break;        }                result.sourceTokens.push_back(reader.lastSourceToken);    }    SourceToken finalToken = {};    finalToken.tokenType = TokenType::None;    result.sourceTokens.push_back(finalToken);        if (!reader.errorMessage.empty())    {        std::cout << reader.errorPosition << " error - "            << reader.errorMessage << '/n';    }        return result;}
开发者ID:TheBuzzSaw,项目名称:KellyScript,代码行数:48,


示例8: while

    void Shader::ExpandIncludes(const string &path, string &source)    {        size_t pos = source.find("#include");        while(pos != string::npos)        {            const size_t firstQuote = source.find("/"", pos);            const size_t secondQuote = source.find("/"", firstQuote + 1);            const size_t len = secondQuote - firstQuote - 1;            const string includeFile = FileToString(path + source.substr(firstQuote + 1, len));            StringReplace(source, source.substr(pos, secondQuote - pos + 1), includeFile);            pos = source.find("#include");        }    }
开发者ID:Aloalo,项目名称:Trayc,代码行数:16,


示例9: GetFileLine

bool GetFileLine(char* sOut, size_t sOutSize, char* sFile, int iLine) {    bool is_found = false;    int iLen;    char sTemp[20] = { 0 };    char* sData;    iLen = FileToString(sFile, (unsigned char**)(&sData));    if(TextLine(sData, iLen, sTemp, 20, iLine)) {        is_found = true;        sprintf_s(sOut, sOutSize, "%s", sTemp);    }    free(sData);    return is_found;}
开发者ID:kavika13,项目名称:jumpmanzero,代码行数:17,


示例10: FileToString

void Wren::executeModule( const std::string& mod ) {    // set global variables for the C-callbacks    boundForeignMethods = &foreignMethods_;    boundForeignClasses = &foreignClasses_;        std::string file = mod;    file += ".wren";    auto source = FileToString( file );    auto res = wrenInterpret( vm_, file.c_str(), source.c_str() );        if ( res == WrenInterpretResult::WREN_RESULT_COMPILE_ERROR ) {        std::cerr << "WREN_RESULT_COMPILE_ERROR in module " << mod << std::endl;    }        if ( res == WrenInterpretResult::WREN_RESULT_RUNTIME_ERROR ) {        std::cerr << "WREN_RESULT_RUNTIME_ERROR in module " << mod << std::endl;    }        boundForeignMethods = nullptr;    boundForeignClasses = nullptr;}
开发者ID:gusa1120,项目名称:wrenly,代码行数:21,


示例11: LoadTypeList

static MagickBooleanType LoadTypeList(const char *xml,const char *filename,  const unsigned long depth,ExceptionInfo *exception){  char    font_path[MaxTextExtent];  const char    *attribute;  TypeInfo    *type_info = (TypeInfo *) NULL;  MagickBooleanType    status;  XMLTreeInfo    *type,    *type_map,    *include;  /*    Load the type map file.  */  (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),    "Loading type map /"%s/" ...",filename);  if (xml == (const char *) NULL)    return(MagickFalse);  if (type_list == (SplayTreeInfo *) NULL)    {      type_list=NewSplayTree(CompareSplayTreeString,(void *(*)(void *)) NULL,        DestroyTypeNode);      if (type_list == (SplayTreeInfo *) NULL)        {          ThrowFileException(exception,ResourceLimitError,            "MemoryAllocationFailed",filename);          return(MagickFalse);        }    }  type_map=NewXMLTree(xml,exception);  if (type_map == (XMLTreeInfo *) NULL)    return(MagickFalse);  status=MagickTrue;  include=GetXMLTreeChild(type_map,"include");  while (include != (XMLTreeInfo *) NULL)  {    /*      Process include element.    */    attribute=GetXMLTreeAttribute(include,"file");    if (attribute != (const char *) NULL)      {        if (depth > 200)          (void) ThrowMagickException(exception,GetMagickModule(),            ConfigureError,"IncludeElementNestedTooDeeply","`%s'",attribute);        else          {            char              path[MaxTextExtent],              *xml;            ExceptionInfo              *sans_exception;            GetPathComponent(filename,HeadPath,path);            if (*path != '/0')              (void) ConcatenateMagickString(path,DirectorySeparator,                MaxTextExtent);            (void) ConcatenateMagickString(path,attribute,MaxTextExtent);            sans_exception=AcquireExceptionInfo();            xml=FileToString(path,~0,sans_exception);            sans_exception=DestroyExceptionInfo(sans_exception);            if (xml != (char *) NULL)              {                status=LoadTypeList(xml,path,depth+1,exception);                xml=DestroyString(xml);              }          }      }    include=GetNextXMLTreeTag(include);  }  *font_path='/0';#if defined(__WINDOWS__)  if (NTGhostscriptFonts(font_path,MaxTextExtent-2))    (void) ConcatenateMagickString(font_path,DirectorySeparator,MaxTextExtent);#endif  type=GetXMLTreeChild(type_map,"type");  while (type != (XMLTreeInfo *) NULL)  {    /*      Process type element.    */    type_info=(TypeInfo *) AcquireMagickMemory(sizeof(*type_info));    if (type_info == (TypeInfo *) NULL)      ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");    (void) ResetMagickMemory(type_info,0,sizeof(*type_info));    type_info->path=ConstantString(filename);    type_info->signature=MagickSignature;    attribute=GetXMLTreeAttribute(type,"encoding");    if (attribute != (const char *) NULL)      type_info->encoding=ConstantString(attribute);//.........这里部分代码省略.........
开发者ID:vazexqi,项目名称:ParsecPipelineParallelism,代码行数:101,


示例12: ReadDNGImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d D N G I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadDNGImage() reads an binary file in the Digital Negative format and%  returns it.  It allocates the memory necessary for the new Image structure%  and returns a pointer to the new image. %%  The format of the ReadDNGImage method is:%%      Image *ReadDNGImage(const ImageInfo *image_info,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image_info: the image info.%%    o exception: return any errors or warnings in this structure.%*/static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception){  ExceptionInfo    *sans_exception;  Image    *image;  ImageInfo    *read_info;  MagickBooleanType    status;  /*    Open image file.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  if (image_info->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",      image_info->filename);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickSignature);  image=AcquireImage(image_info);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  (void) CloseBlob(image);  (void) DestroyImageList(image);  /*    Convert DNG to PPM with delegate.  */  image=AcquireImage(image_info);  read_info=CloneImageInfo(image_info);  (void) InvokeDelegate(read_info,image,"dng:decode",(char *) NULL,exception);  image=DestroyImage(image);  (void) FormatMagickString(read_info->filename,MaxTextExtent,"%s.png",    read_info->unique);  sans_exception=AcquireExceptionInfo();  image=ReadImage(read_info,sans_exception);  sans_exception=DestroyExceptionInfo(sans_exception);  if (image == (Image *) NULL)    {      (void) FormatMagickString(read_info->filename,MaxTextExtent,"%s.ppm",        read_info->unique);      image=ReadImage(read_info,exception);    }  (void) RelinquishUniqueFileResource(read_info->filename);  if (image != (Image *) NULL)    {      char        filename[MaxTextExtent],        *xml;      ExceptionInfo        *sans;      (void) CopyMagickString(image->magick,read_info->magick,MaxTextExtent);      (void) FormatMagickString(filename,MaxTextExtent,"%s.ufraw",        read_info->unique);      sans=AcquireExceptionInfo();      xml=FileToString(filename,MaxTextExtent,sans);      (void) RelinquishUniqueFileResource(filename);      if (xml != (char *) NULL)        {          XMLTreeInfo           *ufraw;          /*//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例13: ThrowFatalException

static SplayTreeInfo *AcquireTypeCache(const char *filename,  ExceptionInfo *exception){  MagickStatusType    status;  SplayTreeInfo    *type_cache;  type_cache=NewSplayTree(CompareSplayTreeString,(void *(*)(void *)) NULL,    DestroyTypeNode);  if (type_cache == (SplayTreeInfo *) NULL)    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");  status=MagickTrue;#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT)  {    char      *font_path,      path[MaxTextExtent];    const StringInfo      *option;    LinkedListInfo      *options;    *path='/0';    options=GetConfigureOptions(filename,exception);    option=(const StringInfo *) GetNextValueInLinkedList(options);    while (option != (const StringInfo *) NULL)    {      (void) CopyMagickString(path,GetStringInfoPath(option),MaxTextExtent);      status&=LoadTypeCache(type_cache,(const char *)        GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);      option=(const StringInfo *) GetNextValueInLinkedList(options);    }    options=DestroyConfigureOptions(options);    font_path=GetEnvironmentValue("MAGICK_FONT_PATH");    if (font_path != (char *) NULL)      {        char          *option;        /*          Search MAGICK_FONT_PATH.        */        (void) FormatLocaleString(path,MaxTextExtent,"%s%s%s",font_path,          DirectorySeparator,filename);        option=FileToString(path,~0UL,exception);        if (option != (void *) NULL)          {            status&=LoadTypeCache(type_cache,option,path,0,exception);            option=DestroyString(option);          }        font_path=DestroyString(font_path);      }  }#endif  if (GetNumberOfNodesInSplayTree(type_cache) == 0)    status&=LoadTypeCache(type_cache,TypeMap,"built-in",0,exception);  return(type_cache);}
开发者ID:INT2208-ST,项目名称:MyFriend,代码行数:62,


示例14: WriteHISTOGRAMImage

//.........这里部分代码省略.........  */  (void) QueryColorCompliance("#000000",AllCompliance,    &histogram_image->background_color,exception);  (void) SetImageBackgroundColor(histogram_image,exception);  for (x=0; x < (ssize_t) histogram_image->columns; x++)  {    q=GetAuthenticPixels(histogram_image,x,0,1,histogram_image->rows,exception);    if (q == (Quantum *) NULL)      break;    if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)      {        y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].red-0.5);        r=q+y*GetPixelChannels(histogram_image);        for ( ; y < (ssize_t) histogram_image->rows; y++)        {          SetPixelRed(histogram_image,QuantumRange,r);          r+=GetPixelChannels(histogram_image);        }      }    if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)      {        y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].green-0.5);        r=q+y*GetPixelChannels(histogram_image);        for ( ; y < (ssize_t) histogram_image->rows; y++)        {          SetPixelGreen(histogram_image,QuantumRange,r);          r+=GetPixelChannels(histogram_image);        }      }    if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)      {        y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].blue-0.5);        r=q+y*GetPixelChannels(histogram_image);        for ( ; y < (ssize_t) histogram_image->rows; y++)        {          SetPixelBlue(histogram_image,QuantumRange,r);          r+=GetPixelChannels(histogram_image);        }      }    if (SyncAuthenticPixels(histogram_image,exception) == MagickFalse)      break;    status=SetImageProgress(image,SaveImageTag,y,histogram_image->rows);    if (status == MagickFalse)      break;  }  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);  option=GetImageOption(image_info,"histogram:unique-colors");  if ((option == (const char *) NULL) || (IsStringTrue(option) != MagickFalse))    {      FILE        *file;      int        unique_file;      /*        Add a unique colors as an image comment.      */      file=(FILE *) NULL;      unique_file=AcquireUniqueFileResource(filename);      if (unique_file != -1)        file=fdopen(unique_file,"wb");      if ((unique_file != -1) && (file != (FILE *) NULL))        {          char            *property;          (void) GetNumberColors(image,file,exception);          (void) fclose(file);          property=FileToString(filename,~0UL,exception);          if (property != (char *) NULL)            {              (void) SetImageProperty(histogram_image,"comment",property,                exception);              property=DestroyString(property);            }        }      (void) RelinquishUniqueFileResource(filename);    }  /*    Write Histogram image.  */  (void) CopyMagickString(histogram_image->filename,image_info->filename,    MagickPathExtent);  write_info=CloneImageInfo(image_info);  *write_info->magick='/0';  (void) SetImageInfo(write_info,1,exception);  if ((*write_info->magick == '/0') ||      (LocaleCompare(write_info->magick,"HISTOGRAM") == 0))    (void) FormatLocaleString(histogram_image->filename,MagickPathExtent,      "miff:%s",write_info->filename);  histogram_image->blob=DetachBlob(histogram_image->blob);  histogram_image->blob=CloneBlobInfo(image->blob);  status=WriteImage(write_info,histogram_image,exception);  image->blob=DetachBlob(image->blob);  image->blob=CloneBlobInfo(histogram_image->blob);  histogram_image=DestroyImage(histogram_image);  write_info=DestroyImageInfo(write_info);  return(status);}
开发者ID:278443820,项目名称:ImageMagick,代码行数:101,


示例15: WriteHISTOGRAMImage

//.........这里部分代码省略.........  maximum=histogram[0].red;  for (x=0; x < (long) histogram_image->columns; x++)  {    if (((channel & RedChannel) != 0) && (maximum < histogram[x].red))      maximum=histogram[x].red;    if (((channel & GreenChannel) != 0) && (maximum < histogram[x].green))      maximum=histogram[x].green;    if (((channel & BlueChannel) != 0) && (maximum < histogram[x].blue))      maximum=histogram[x].blue;  }  scale=(MagickRealType) histogram_image->rows/maximum;  /*    Initialize histogram image.  */  exception=(&image->exception);  (void) QueryColorDatabase("#000000",&histogram_image->background_color,    &image->exception);  (void) SetImageBackgroundColor(histogram_image);  for (x=0; x < (long) histogram_image->columns; x++)  {    q=GetAuthenticPixels(histogram_image,x,0,1,histogram_image->rows,exception);    if (q == (PixelPacket *) NULL)      break;    if ((channel & RedChannel) != 0)      {        y=(long) (histogram_image->rows-scale*histogram[x].red+0.5);        r=q+y;        for ( ; y < (long) histogram_image->rows; y++)        {          r->red=(Quantum) QuantumRange;          r++;        }      }    if ((channel & GreenChannel) != 0)      {        y=(long) (histogram_image->rows-scale*histogram[x].green+0.5);        r=q+y;        for ( ; y < (long) histogram_image->rows; y++)        {          r->green=(Quantum) QuantumRange;          r++;        }      }    if ((channel & BlueChannel) != 0)      {        y=(long) (histogram_image->rows-scale*histogram[x].blue+0.5);        r=q+y;        for ( ; y < (long) histogram_image->rows; y++)        {          r->blue=(Quantum) QuantumRange;          r++;        }      }    if (SyncAuthenticPixels(histogram_image,exception) == MagickFalse)      break;    status=SetImageProgress(image,SaveImageTag,y,histogram_image->rows);    if (status == MagickFalse)      break;  }  /*    Relinquish resources.  */  histogram=(MagickPixelPacket *) RelinquishMagickMemory(histogram);  file=(FILE *) NULL;  unique_file=AcquireUniqueFileResource(filename);  if (unique_file != -1)    file=fdopen(unique_file,"wb");  if ((unique_file != -1) && (file != (FILE *) NULL))    {      char        *property;      /*        Add a histogram as an image comment.      */      (void) GetNumberColors(image,file,&image->exception);      (void) fclose(file);      property=FileToString(filename,~0UL,&image->exception);      if (property != (char *) NULL)        {          (void) SetImageProperty(histogram_image,"comment",property);          property=DestroyString(property);        }    }  (void) RelinquishUniqueFileResource(filename);  /*    Write Histogram image.  */  (void) CopyMagickString(histogram_image->filename,image_info->filename,    MaxTextExtent);  write_info=CloneImageInfo(image_info);  (void) SetImageInfo(write_info,MagickTrue,&image->exception);  if (LocaleCompare(write_info->magick,"HISTOGRAM") == 0)    (void) FormatMagickString(histogram_image->filename,MaxTextExtent,      "miff:%s",write_info->filename);  status=WriteImage(write_info,histogram_image);  histogram_image=DestroyImage(histogram_image);  write_info=DestroyImageInfo(write_info);  return(status);}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例16: CopyFileToErr

void CopyFileToErr(const std::string &Path) {  Printf("%s", FileToString(Path).c_str());}
开发者ID:BlueRiverInteractive,项目名称:llvm,代码行数:3,


示例17: LoadLocaleList

//.........这里部分代码省略.........        while (((*token != '/') && (*(token+1) != '>')) && (*q != '/0'))        {          (void) CopyMagickString(keyword,token,MaxTextExtent);          GetMagickToken(q,&q,token);          if (*token != '=')            continue;          GetMagickToken(q,&q,token);          if (LocaleCompare(keyword,"locale") == 0)            {              if (LocaleCompare(locale,token) != 0)                break;              continue;            }          if (LocaleCompare(keyword,"file") == 0)            {              if (depth > 200)                (void) ThrowMagickException(exception,GetMagickModule(),                  ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);              else                {                  char                    path[MaxTextExtent],                    *xml;                  *path='/0';                  GetPathComponent(filename,HeadPath,path);                  if (*path != '/0')                    (void) ConcatenateMagickString(path,DirectorySeparator,                      MaxTextExtent);                  if (*token == *DirectorySeparator)                    (void) CopyMagickString(path,token,MaxTextExtent);                  else                    (void) ConcatenateMagickString(path,token,MaxTextExtent);                  xml=FileToString(path,~0,exception);                  if (xml != (char *) NULL)                    {                      status=LoadLocaleList(xml,path,locale,depth+1,exception);                      xml=(char *) RelinquishMagickMemory(xml);                    }                }            }        }        continue;      }    if (LocaleCompare(keyword,"<locale") == 0)      {        /*          Locale element.        */        while ((*token != '>') && (*q != '/0'))        {          (void) CopyMagickString(keyword,token,MaxTextExtent);          GetMagickToken(q,&q,token);          if (*token != '=')            continue;          GetMagickToken(q,&q,token);        }        continue;      }    if (LocaleCompare(keyword,"</locale>") == 0)      {        ChopLocaleComponents(tag,1);        (void) ConcatenateMagickString(tag,"/",MaxTextExtent);        continue;      }    if (LocaleCompare(keyword,"<localemap>") == 0)
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,


示例18: LoadMimeList

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %+   L o a d M i m e L i s t                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  LoadMimeList() loads the magic configuration file which provides a mapping%  between magic attributes and a magic name.%%  The format of the LoadMimeList method is:%%      MagickBooleanType LoadMimeList(const char *xml,const char *filename,%        const size_t depth,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o xml:  The mime list in XML format.%%    o filename:  The mime list filename.%%    o depth: depth of <include /> statements.%%    o exception: return any errors or warnings in this structure.%*/static MagickBooleanType LoadMimeList(const char *xml,const char *filename,  const size_t depth,ExceptionInfo *exception){  const char    *attribute;  MimeInfo    *mime_info = (MimeInfo *) NULL;  MagickBooleanType    status;  XMLTreeInfo    *mime,    *mime_map,    *include;  /*    Load the mime map file.  */  (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),    "Loading mime map /"%s/" ...",filename);  if (xml == (const char *) NULL)    return(MagickFalse);  if (mime_list == (LinkedListInfo *) NULL)    {      mime_list=NewLinkedList(0);      if (mime_list == (LinkedListInfo *) NULL)        {          ThrowFileException(exception,ResourceLimitError,            "MemoryAllocationFailed",filename);          return(MagickFalse);        }    }  mime_map=NewXMLTree(xml,exception);  if (mime_map == (XMLTreeInfo *) NULL)    return(MagickFalse);  status=MagickTrue;  include=GetXMLTreeChild(mime_map,"include");  while (include != (XMLTreeInfo *) NULL)  {    /*      Process include element.    */    attribute=GetXMLTreeAttribute(include,"file");    if (attribute != (const char *) NULL)      {        if (depth > 200)          (void) ThrowMagickException(exception,GetMagickModule(),            ConfigureError,"IncludeElementNestedTooDeeply","`%s'",filename);        else          {            char              path[MaxTextExtent],              *xml;            GetPathComponent(filename,HeadPath,path);            if (*path != '/0')              (void) ConcatenateMagickString(path,DirectorySeparator,                MaxTextExtent);            if (*attribute == *DirectorySeparator)              (void) CopyMagickString(path,attribute,MaxTextExtent);            else              (void) ConcatenateMagickString(path,attribute,MaxTextExtent);            xml=FileToString(path,~0UL,exception);            if (xml != (char *) NULL)              {                status=LoadMimeList(xml,path,depth+1,exception);                xml=DestroyString(xml);              }//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例19: FileToString

bool TestLogger::IsStringInFile(CStdString sFile, CStdString sString){	CStdString sTargetString	= FileToString(sFile);	return (StrStr(sTargetString,sString) !=0 );}
开发者ID:killbug2004,项目名称:WSProf,代码行数:5,


示例20: assert

//.........这里部分代码省略.........%      Image *ReadMVGImage(const ImageInfo *image_info,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image_info: the image info.%%    o exception: return any errors or warnings in this structure.%*/static Image *ReadMVGImage(const ImageInfo *image_info,ExceptionInfo *exception){#define BoundingBox  "viewbox"    DrawInfo    *draw_info;    Image    *image;    MagickBooleanType    status;    /*      Open image.    */    assert(image_info != (const ImageInfo *) NULL);    assert(image_info->signature == MagickSignature);    if (image_info->debug != MagickFalse)        (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",                              image_info->filename);    assert(exception != (ExceptionInfo *) NULL);    assert(exception->signature == MagickSignature);    image=AcquireImage(image_info);    status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);    if (status == MagickFalse)    {        image=DestroyImageList(image);        return((Image *) NULL);    }    if ((image->columns == 0) || (image->rows == 0))    {        char        primitive[MaxTextExtent];        register char        *p;        SegmentInfo        bounds;        /*          Determine size of image canvas.        */        while (ReadBlobString(image,primitive) != (char *) NULL)        {            for (p=primitive; (*p == ' ') || (*p == '/t'); p++) ;            if (LocaleNCompare(BoundingBox,p,strlen(BoundingBox)) != 0)                continue;            (void) sscanf(p,"viewbox %lf %lf %lf %lf",&bounds.x1,&bounds.y1,                          &bounds.x2,&bounds.y2);            image->columns=(size_t) floor((bounds.x2-bounds.x1)+0.5);            image->rows=(size_t) floor((bounds.y2-bounds.y1)+0.5);            break;        }    }    if ((image->columns == 0) || (image->rows == 0))        ThrowReaderException(OptionError,"MustSpecifyImageSize");    draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL);    draw_info->affine.sx=image->x_resolution == 0.0 ? 1.0 : image->x_resolution/                         DefaultResolution;    draw_info->affine.sy=image->y_resolution == 0.0 ? 1.0 : image->y_resolution/                         DefaultResolution;    image->columns=(size_t) (draw_info->affine.sx*image->columns);    image->rows=(size_t) (draw_info->affine.sy*image->rows);    if (SetImageBackgroundColor(image) == MagickFalse)    {        InheritException(exception,&image->exception);        image=DestroyImageList(image);        return((Image *) NULL);    }    /*      Render drawing.    */    if (GetBlobStreamData(image) == (unsigned char *) NULL)        draw_info->primitive=FileToString(image->filename,~0UL,exception);    else    {        draw_info->primitive=(char *) AcquireMagickMemory(GetBlobSize(image)+1);        if (draw_info->primitive != (char *) NULL)        {            CopyMagickMemory(draw_info->primitive,GetBlobStreamData(image),                             GetBlobSize(image));            draw_info->primitive[GetBlobSize(image)]='/0';        }    }    (void) DrawImage(image,draw_info);    draw_info=DestroyDrawInfo(draw_info);    (void) CloseBlob(image);    return(GetFirstImageInList(image));}
开发者ID:leloulight,项目名称:cs225,代码行数:101,


示例21: LoadMagicList

//.........这里部分代码省略.........        continue;      }    if (LocaleCompare(keyword,"<include") == 0)      {        /*          Include element.        */        while (((*token != '/') && (*(token+1) != '>')) && (*q != '/0'))        {          (void) CopyMagickString(keyword,token,MaxTextExtent);          GetMagickToken(q,&q,token);          if (*token != '=')            continue;          GetMagickToken(q,&q,token);          if (LocaleCompare(keyword,"file") == 0)            {              if (depth > 200)                (void) ThrowMagickException(exception,GetMagickModule(),                  ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);              else                {                  char                    path[MaxTextExtent],                    *xml;                  GetPathComponent(filename,HeadPath,path);                  if (*path != '/0')                    (void) ConcatenateMagickString(path,DirectorySeparator,                      MaxTextExtent);                  if (*token == *DirectorySeparator)                    (void) CopyMagickString(path,token,MaxTextExtent);                  else                    (void) ConcatenateMagickString(path,token,MaxTextExtent);                  xml=FileToString(path,~0,exception);                  if (xml != (char *) NULL)                    {                      status=LoadMagicList(xml,path,depth+1,exception);                      xml=(char *) RelinquishMagickMemory(xml);                    }                }            }        }        continue;      }    if (LocaleCompare(keyword,"<magic") == 0)      {        /*          Magic element.        */        magic_info=(MagicInfo *) AcquireMagickMemory(sizeof(*magic_info));        if (magic_info == (MagicInfo *) NULL)          ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");        (void) ResetMagickMemory(magic_info,0,sizeof(*magic_info));        magic_info->path=ConstantString(filename);        magic_info->exempt=MagickFalse;        magic_info->signature=MagickSignature;        continue;      }    if (magic_info == (MagicInfo *) NULL)      continue;    if (LocaleCompare(keyword,"/>") == 0)      {        status=AppendValueToLinkedList(magic_list,magic_info);        if (status == MagickFalse)          (void) ThrowMagickException(exception,GetMagickModule(),            ResourceLimitError,"MemoryAllocationFailed","`%s'",
开发者ID:alessio-ragni,项目名称:unix-toolbox.js-imagemagick,代码行数:67,


示例22: LoadConfigureList

//.........这里部分代码省略.........        continue;      }    if (LocaleCompare(keyword,"<include") == 0)      {        /*          Include element.        */        while (((*token != '/') && (*(token+1) != '>')) && (*q != '/0'))        {          (void) CopyMagickString(keyword,token,MaxTextExtent);          GetMagickToken(q,&q,token);          if (*token != '=')            continue;          GetMagickToken(q,&q,token);          if (LocaleCompare(keyword,"file") == 0)            {              if (depth > 200)                (void) ThrowMagickException(exception,GetMagickModule(),                  ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);              else                {                  char                    path[MaxTextExtent],                    *xml;                  GetPathComponent(filename,HeadPath,path);                  if (*path != '/0')                    (void) ConcatenateMagickString(path,DirectorySeparator,                      MaxTextExtent);                  if (*token == *DirectorySeparator)                    (void) CopyMagickString(path,token,MaxTextExtent);                  else                    (void) ConcatenateMagickString(path,token,MaxTextExtent);                  xml=FileToString(path,~0,exception);                  if (xml != (char *) NULL)                    {                      status=LoadConfigureList(xml,path,depth+1,exception);                      xml=(char *) RelinquishMagickMemory(xml);                    }                }            }        }        continue;      }    if (LocaleCompare(keyword,"<configure") == 0)      {        /*          Configure element.        */        configure_info=(ConfigureInfo *) AcquireMagickMemory(          sizeof(*configure_info));        if (configure_info == (ConfigureInfo *) NULL)          ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");        (void) ResetMagickMemory(configure_info,0,sizeof(*configure_info));        configure_info->path=ConstantString(filename);        configure_info->exempt=MagickFalse;        configure_info->signature=MagickSignature;        continue;      }    if (configure_info == (ConfigureInfo *) NULL)      continue;    if (LocaleCompare(keyword,"/>") == 0)      {        status=AppendValueToLinkedList(configure_list,configure_info);        if (status == MagickFalse)          (void) ThrowMagickException(exception,GetMagickModule(),
开发者ID:MaximOrlovsky,项目名称:unix-toolbox.js-imagemagick,代码行数:67,


示例23: LoadCoderList

static MagickBooleanType LoadCoderList(const char *xml,const char *filename,  const unsigned long depth,ExceptionInfo *exception){  char    keyword[MaxTextExtent],    *q,    *token;  CoderInfo    *coder_info = (CoderInfo *) NULL;  MagickBooleanType    status;  /*    Load the coder map file.  */  (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),    "Loading coder file /"%s/" ...",filename);  if (xml == (const char *) NULL)    return(MagickFalse);  if (coder_list == (SplayTreeInfo *) NULL)    {      coder_list=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,        DestroyCoderNode);      if (coder_list == (SplayTreeInfo *) NULL)        {          ThrowFileException(exception,ResourceLimitError,            "MemoryAllocationFailed",filename);          return(MagickFalse);        }    }  status=MagickTrue;  token=AcquireString(xml);  for (q=(char *) xml; *q != '/0'; )  {    /*      Interpret XML.    */    GetMagickToken(q,&q,token);    if (*token == '/0')      break;    (void) CopyMagickString(keyword,token,MaxTextExtent);    if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)      {        /*          Doctype element.        */        while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '/0'))          GetMagickToken(q,&q,token);        continue;      }    if (LocaleNCompare(keyword,"<!--",4) == 0)      {        /*          Comment element.        */        while ((LocaleNCompare(q,"->",2) != 0) && (*q != '/0'))          GetMagickToken(q,&q,token);        continue;      }    if (LocaleCompare(keyword,"<include") == 0)      {        /*          Include element.        */        while (((*token != '/') && (*(token+1) != '>')) && (*q != '/0'))        {          (void) CopyMagickString(keyword,token,MaxTextExtent);          GetMagickToken(q,&q,token);          if (*token != '=')            continue;          GetMagickToken(q,&q,token);          if (LocaleCompare(keyword,"file") == 0)            {              if (depth > 200)                (void) ThrowMagickException(exception,GetMagickModule(),                  ConfigureError,"IncludeNodeNestedTooDeeply","`%s'",token);              else                {                  char                    path[MaxTextExtent],                    *xml;                  GetPathComponent(filename,HeadPath,path);                  if (*path != '/0')                    (void) ConcatenateMagickString(path,DirectorySeparator,                      MaxTextExtent);                  (void) ConcatenateMagickString(path,token,MaxTextExtent);                  xml=FileToString(path,~0,exception);                  if (LoadCoderList(xml,path,depth+1,exception) == MagickFalse)                    status=MagickFalse;                  xml=(char *) RelinquishMagickMemory(xml);                }            }        }        continue;      }    if (LocaleCompare(keyword,"<coder") == 0)      {//.........这里部分代码省略.........
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:101,


示例24: FileToString

istAPI bool FileToString( const stl::string &path, stl::string &out ){    return FileToString(path.c_str(), out);}
开发者ID:ezhangle,项目名称:atomic,代码行数:4,



注:本文中的FileToString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FileWriter函数代码示例
C++ FileTimeToSystemTime函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。