问题列表 - 第49427页

使用C/C++在iOS中写入文件

是否可以在iOS中使用C/C++调用创建文本文件?那么可以从应用程序外部打开和读取文件吗?也就是说,应用程序A在某个地方创建一个文本文件,它有权写入,然后应用程序B从中读取.或者,忘记应用程序B,我可以打开它并阅读吗?

c c++ file-io ios

8
推荐指数
2
解决办法
6143
查看次数

C++如何在类中获取静态变量?

我无法使用静态变量和c ++类获得正确的语法.

这是一个简单的例子来显示我的问题.

我有一个函数更新一个应该对所有对象都相同的变量,然后我有另一个想要使用该变量的函数.在这个例子中,我只是返回它.

#include <QDebug>

class Nisse
{
    private: 
        //I would like to put it here:
        //static int cnt;
    public: 
        void print()
        {
            //And not here...!
            static int cnt = 0;
            cnt ++;
            qDebug() << "cnt:" << cnt;
        };

        int howMany()
        {
            //So I can return it here.
            //return cnt;
        }
};

int main(int argc, char *argv[])
{
    qDebug() << "Hello";
    Nisse n1;
    n1.print();

    Nisse n2;
    n2.print();
}
Run Code Online (Sandbox Code Playgroud)

print函数中的当前本地静态是该函数的本地静态,但我希望它是"类中的私有和全局".

感觉我在这里缺少一些基本的:s c ++语法.

/谢谢


方案:

我错过了

int Nisse::cnt = …
Run Code Online (Sandbox Code Playgroud)

c++ static

3
推荐指数
1
解决办法
2481
查看次数

获取ColdFusion中查询或结构中的列数

是否有任何权宜之计(最好没有循环)方式来获取查询结果中的列数?我正在处理一个使用数据集而不知道其细节的模块.

coldfusion

4
推荐指数
1
解决办法
4107
查看次数

当short int []自动转换为long int []时会发生什么?

在C++中,如果我有一个短整数数组并将其作为参数传递给一个采用长整数数组的函数,那么函数是否会将short数组的每个值转换为long int或整个数组将被重新解释成为一个由n/2个元素组成的长整数?

c++ arrays casting

0
推荐指数
1
解决办法
428
查看次数

如何在ViewState中保存数组并能够在页面卸载后检索它?

请使用以下代码:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace Test
{
    public partial class _Default : System.Web.UI.Page
    {
        private List<Customer> CustomerList;
        protected void Page_Load(object sender, EventArgs e)
        {
            // Quickly Illustrate  Creation of a List of that contains information;
            //CustomerList = (!this.IsPostBack) ? new List<Customer>() : new List<Customer>((Customer[])ViewState["Customers"]);
            if (IsPostBack)
                CustomerList = new List<Customer>((Customer[])ViewState["Customers"]);
            else
                CustomerList = new List<Customer>();
            // Convert …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net

0
推荐指数
1
解决办法
1796
查看次数

Java我的程序的数组没有显示任何值

我正在编写一个程序来搜索字符串并告诉我它是否被发现.

import java.io.*;


public class BinarySearchTest
{
   public static void main(String [] args) throws IOException
   {
      int result;
      String searchValue;
      String input;

      // An array of numbers to search.
      String[] numbers = {"Jake", "Jerry", "Bill", "Lousie", "Goku", "Ivan", "John", "sarah", "kim"};

      // Create the console input objects.
      InputStreamReader reader =
                 new InputStreamReader(System.in);
      BufferedReader keyboard =
                 new BufferedReader(reader);

      // First we must sort the array in ascending order.
      IntQuickSorter.quickSort(numbers);

      do
      {
         // Get a value to search for.
         System.out.print("Enter a value …
Run Code Online (Sandbox Code Playgroud)

java eclipse arrays

0
推荐指数
1
解决办法
400
查看次数

Percona和MySQL Workbench

有谁知道MySQL Workbench是否可以与Percona 5.1服务器一起使用?

如果没有,有人会建议一个类似的工具吗?

mysql mysql-workbench percona

4
推荐指数
1
解决办法
2294
查看次数

无法连接到远程MS Access数据库

我一直在接受

InvalidOperationException:ExecuteReader需要一个开放且可用的连接.连接的当前状态已关闭.]

这是因为我的连接已关闭.我的连接字符串有什么问题?为什么不打开它.

    protected void Page_Load(object sender, EventArgs e)
    {
        // Declaration section

        //OleDbConnection objDBConn;
        OleDbCommand    objCmd;
        OleDbDataReader objDR;

        //create connection object
        System.Data.OleDb.OleDbConnection conn = new
          System.Data.OleDb.OleDbConnection();

        // Modify the connection string and include any
        // additional required properties for your database.
        conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
            @"Data source= c:\inetpub\wwwroot\cm485a2\rreAccesscm485a2.mdb";

          // Create OleDbCommand object with SQL to execute
            objCmd = new OleDbCommand("SELECT * " +
                            "  FROM customers " +
                            " ORDER BY cust_id", conn);

            // Create a DataReader and execute …
Run Code Online (Sandbox Code Playgroud)

c# asp.net ms-access

2
推荐指数
1
解决办法
1567
查看次数

DOM XPath查询帮助

所以这个xpath查询让我抓狂.我正在尝试做的是搜索一个特定课程类型的高尔夫球场的xml文件(在这种情况下是与谷歌地图api一起使用的kml文件)并抓取每个匹配的<Placemark>元素,以便我可以创建一个新的xml对象结果,以便我可以进一步使用新查询进行过滤.问题是我似乎无法弄清楚如何获得每个匹配<Placemark>元素

$xml = '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
    <Document>
      <Placemark id="placemark3">
          <name>Test Country Club</name>
          <description>
              <![CDATA[
                 <div class="contact">Post Office Box 329 <a href="#" target="_blank">website</a></div>
              ]]>
          </description>
          <alpha>a</alpha>
          <position>2</position>
          <type>Public/Daily Fee</type>
          <styleUrl>#nineholeStyle</styleUrl>
          <Point>
              <coordinates>-79.285576,37.111809</coordinates>
          </Point>
      </Placemark>
  </Document>
</kml>';

$dom = new DOMDocument();
$dom->loadXML($xml);
$xpath = new DOMXPath($dom);

//trying to get any Placemark element where type child matches a specific query
//in this case we want to search for Public/Daily Fee and return the placemark and everything inside …
Run Code Online (Sandbox Code Playgroud)

php xpath dom

3
推荐指数
1
解决办法
2110
查看次数

HTMl敏捷包错误解析并返回XElement

我可以解析文档并生成输出,但是由于ap标记,输出无法解析为XElement,字符串中的所有其他内容都被正确解析.

我的意见:

var input = "<p> Not sure why is is null for some wierd reason!<br><br>I have implemented the auto save feature, but does it really work after 100s?<br></p> <p> <i>Autosave?? </i> </p> <p>we are talking...</p><p></p><hr><p><br class=\"GENTICS_ephemera\"></p>";
Run Code Online (Sandbox Code Playgroud)

我的代码:

public static XElement CleanupHtml(string input)
    {  


    HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();

    htmlDoc.OptionOutputAsXml = true;
    //htmlDoc.OptionWriteEmptyNodes = true;             
    //htmlDoc.OptionAutoCloseOnEnd = true;
    htmlDoc.OptionFixNestedTags = true;

    htmlDoc.LoadHtml(input);

    // ParseErrors is an ArrayList containing any errors from the Load statement
    if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() …
Run Code Online (Sandbox Code Playgroud)

c# html-parsing .net-3.5 html-agility-pack

6
推荐指数
1
解决办法
5113
查看次数